mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-15 23:00:19 +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)
|
log.Printf("WARN: encode changes to JSON failed: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, err = http.Post(
|
var resp *http.Response
|
||||||
url, "application/json", bytes.NewBuffer(buf.Bytes())); err != nil {
|
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)
|
log.Printf("WARN: posting changes to %s failed: %s\n", url, err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user