From: Ruben Kerkhof Date: Sat, 28 Nov 2015 19:19:26 +0000 (+0100) Subject: csv plugin: plug memory leak on error X-Git-Tag: collectd-5.5.1~40^2~22 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ab2e3c958d3fed41438a8b3c2d0cca21b1bca56f;p=collectd.git csv plugin: plug memory leak on error CID 38015 Signed-off-by: Florian Forster --- diff --git a/src/csv.c b/src/csv.c index 958e34ba..5268237e 100644 --- a/src/csv.c +++ b/src/csv.c @@ -65,13 +65,16 @@ static int value_list_to_string (char *buffer, int buffer_len, && (ds->ds[i].type != DS_TYPE_GAUGE) && (ds->ds[i].type != DS_TYPE_DERIVE) && (ds->ds[i].type != DS_TYPE_ABSOLUTE)) + { + sfree (rates); return (-1); + } - if (ds->ds[i].type == DS_TYPE_GAUGE) + if (ds->ds[i].type == DS_TYPE_GAUGE) { status = ssnprintf (buffer + offset, buffer_len - offset, ",%lf", vl->values[i].gauge); - } + } else if (store_rates != 0) { if (rates == NULL)