From: Ruben Kerkhof Date: Fri, 4 Dec 2015 20:50:55 +0000 (+0100) Subject: types_list.c: fix two resource leaks X-Git-Tag: collectd-5.6.0~524^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=fb42747f9a9ddf16e684d7cd5d8b60dd8cfca489;p=collectd.git types_list.c: fix two resource leaks CID #38017 --- diff --git a/src/daemon/types_list.c b/src/daemon/types_list.c index 75a980aa..cf28c2e1 100644 --- a/src/daemon/types_list.c +++ b/src/daemon/types_list.c @@ -122,14 +122,18 @@ static void parse_line (char *buf) ds->ds_num = fields_num - 1; ds->ds = (data_source_t *) calloc (ds->ds_num, sizeof (data_source_t)); if (ds->ds == NULL) + { + sfree (ds); return; + } for (i = 0; i < ds->ds_num; i++) if (parse_ds (ds->ds + i, fields[i + 1], strlen (fields[i + 1])) != 0) { - sfree (ds->ds); ERROR ("types_list: parse_line: Cannot parse data source #%zu " "of data set %s", i, ds->type); + sfree (ds->ds); + sfree (ds); return; }