]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
write_stackdriver plugin: Check pointer for NULL before dereferencing it.
authorFlorian Forster <octo@collectd.org>
Thu, 18 Oct 2018 13:49:37 +0000 (15:49 +0200)
committerFlorian Forster <ff@octo.it>
Thu, 18 Oct 2018 16:52:13 +0000 (18:52 +0200)
src/write_stackdriver.c

index 9d06c25039c496b41d9d329ad506267b9a3c4b09..421df2da83d2593a5b9a74eb145f3e0b8e6a0287 100644 (file)
@@ -225,8 +225,10 @@ static int do_post(wg_callback_t *cb, char const *url, void const *payload,
 
   if (status != CURLE_OK) {
     ERROR("write_stackdriver plugin: POST %s failed: %s", url, cb->curl_errbuf);
-    sfree(ret_content->memory);
-    ret_content->size = 0;
+    if (ret_content != NULL) {
+      sfree(ret_content->memory);
+      ret_content->size = 0;
+    }
     return -1;
   }