From 375061c5b3d377fa3853354b70a85bb141311bc5 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Mon, 16 Oct 2017 19:05:20 +0700 Subject: [PATCH] write_http: Added strdup() result check --- src/write_http.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.11.0