]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Fix memory leaks in write_http plugin
authorBarbara Kaczorowska <bkjg@google.com>
Tue, 15 Sep 2020 09:56:46 +0000 (09:56 +0000)
committerBarbara Kaczorowska <bkjg@google.com>
Tue, 15 Sep 2020 09:56:46 +0000 (09:56 +0000)
src/write_http.c

index 1986f68049271be356e5c8f927394d404a5d9f39..4298b356a576ff05d32bec5dded169efc30677bc 100644 (file)
@@ -290,7 +290,10 @@ static int wh_flush(cdtime_t timeout,
     return ENOMEM;
   }
 
-  return wh_post(cb, json);
+  int status = wh_post(cb, json);
+  free((char*)json);
+
+  return status;
 } /* int wh_flush */
 
 static void wh_callback_free(void *data) {
@@ -314,6 +317,8 @@ static void wh_callback_free(void *data) {
     cb->headers = NULL;
   }
 
+  STRBUF_DESTROY(cb->send_buffer);
+  
   sfree(cb->name);
   sfree(cb->location);
   sfree(cb->user);