diff --git a/cmd/mtredisalize/changetracker.go b/cmd/mtredisalize/changetracker.go index 87681c9..6819aee 100644 --- a/cmd/mtredisalize/changetracker.go +++ b/cmd/mtredisalize/changetracker.go @@ -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) } }()