From e452e3fd5bfc9038c10721e75c2771feb9827065 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sun, 6 Dec 2015 12:21:45 +0100 Subject: [PATCH] write_kafka: fix two leaks on error CID #38124 --- src/write_kafka.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.30.2