From ab2e3c958d3fed41438a8b3c2d0cca21b1bca56f Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 28 Nov 2015 20:19:26 +0100 Subject: [PATCH] csv plugin: plug memory leak on error CID 38015 Signed-off-by: Florian Forster --- src/csv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) -- 2.30.2