From: Pavel Rochnyack Date: Mon, 16 Oct 2017 12:05:20 +0000 (+0700) Subject: write_http: Added strdup() result check X-Git-Tag: collectd-5.8.0~41^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=375061c5b3d377fa3853354b70a85bb141311bc5;p=collectd.git write_http: Added strdup() result check --- diff --git a/src/write_http.c b/src/write_http.c index c391e693..16a21e65 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -637,6 +637,12 @@ static int wh_config_node(oconfig_item_t *ci) /* {{{ */ cb->data_ttl = 0; cb->metrics_prefix = strdup(WRITE_HTTP_DEFAULT_PREFIX); + if (cb->metrics_prefix == NULL) { + ERROR("write_http plugin: strdup failed."); + sfree(cb); + return -1; + } + pthread_mutex_init(&cb->send_lock, /* attr = */ NULL); cf_util_get_string(ci, &cb->name);