From: Ruben Kerkhof Date: Fri, 9 Dec 2016 14:41:18 +0000 (+0100) Subject: write_prometheus: plug a small leak X-Git-Tag: collectd-5.7.1~16^2 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=7f24a5e470b7cac59fcdb56df27021ffb122ba1f;p=collectd.git write_prometheus: plug a small leak Found by scan-build --- diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 991415ef..6b77712e 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -694,8 +694,10 @@ metric_family_get(data_set_t const *ds, value_list_t const *vl, size_t ds_index, return fam; } - if (!allocate) + if (!allocate) { + sfree(name); return NULL; + } fam = metric_family_create(name, ds, vl, ds_index); if (fam == NULL) {