fix: close resp body (#404)

This commit is contained in:
guangwu
2024-05-22 00:26:45 +08:00
committed by GitHub
parent 270fa0be21
commit 34e4aa8a77

View File

@@ -63,6 +63,7 @@ func loadNewTracker() {
} }
resp, err := http.Get("https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt") resp, err := http.Get("https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt")
if err == nil { if err == nil {
defer resp.Body.Close()
buf, err := io.ReadAll(resp.Body) buf, err := io.ReadAll(resp.Body)
if err == nil { if err == nil {
arr := strings.Split(string(buf), "\n") arr := strings.Split(string(buf), "\n")