mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Updates #15 Prevent a potential file handle leak in sending update notifications via POST to mtwebmapper.
This commit is contained in:
parent
5730da652b
commit
4522708ddf
@ -64,8 +64,13 @@ func (ct *ChangeTracker) FlushChanges(url string) {
|
||||
log.Printf("WARN: encode changes to JSON failed: %s\n", err)
|
||||
return
|
||||
}
|
||||
if _, err = http.Post(
|
||||
url, "application/json", bytes.NewBuffer(buf.Bytes())); err != nil {
|
||||
var resp *http.Response
|
||||
resp, err = http.Post(
|
||||
url, "application/json", bytes.NewBuffer(buf.Bytes()))
|
||||
if resp != nil {
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
if err != nil {
|
||||
log.Printf("WARN: posting changes to %s failed: %s\n", url, err)
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user