Skip to content

Commit

Permalink
Trying to fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
h00s committed Jan 24, 2024
1 parent 088dca3 commit 85cae2e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/models/wunderground.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package models

import (
"fmt"
"io"
"net/http"

"github.com/h00s-go/wunderground-bridge/config"
Expand All @@ -22,8 +23,10 @@ func (w *Wunderground) Update(query string) error {
url := fmt.Sprintf("%v?%v", w.Config.UpdateURL, query)
response, err := http.Get(url)
if err != nil {
response.Body.Close()
return err
}
defer response.Body.Close()
_, err = io.ReadAll(response.Body)
return err
}
return nil
Expand Down

0 comments on commit 85cae2e

Please sign in to comment.