From: Ruben Kerkhof Date: Sun, 6 Dec 2015 11:21:45 +0000 (+0100) Subject: write_kafka: fix two leaks on error X-Git-Tag: collectd-5.6.0~513^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e452e3fd5bfc9038c10721e75c2771feb9827065;p=collectd.git write_kafka: fix two leaks on error CID #38124 --- diff --git a/src/write_kafka.c b/src/write_kafka.c index a5977aba..736fddb1 100644 --- a/src/write_kafka.c +++ b/src/write_kafka.c @@ -453,12 +453,15 @@ static int kafka_config(oconfig_item_t *ci) /* {{{ */ } if ((val = strdup(child->values[1].value.string)) == NULL) { WARNING("cannot allocate memory for attribute value."); + sfree(key); goto errout; } ret = rd_kafka_conf_set(conf, key, val, errbuf, sizeof(errbuf)); if (ret != RD_KAFKA_CONF_OK) { WARNING("cannot set kafka property %s to %s: %s", key, val, errbuf); + sfree(key); + sfree(val); goto errout; } sfree(key);