From: Florian Forster Date: Thu, 18 Oct 2018 13:49:37 +0000 (+0200) Subject: write_stackdriver plugin: Check pointer for NULL before dereferencing it. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5b0de49bab071d109e3cebe00aab7a5510f5f13e;p=collectd.git write_stackdriver plugin: Check pointer for NULL before dereferencing it. --- diff --git a/src/write_stackdriver.c b/src/write_stackdriver.c index 9d06c250..421df2da 100644 --- a/src/write_stackdriver.c +++ b/src/write_stackdriver.c @@ -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; }