X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fdaemon%2Ftypes_list.c;h=eb50bb8a390969fcf580419b944e05b7fec537b8;hb=43ef00c0eb99991902d3c9a5fbe582cde049b055;hp=4023a8f609759920d18bcdb4503c295a7f70be57;hpb=aedf67e69cbe93a6925fd1004a7c8b990aed4b0a;p=collectd.git diff --git a/src/daemon/types_list.c b/src/daemon/types_list.c index 4023a8f6..eb50bb8a 100644 --- a/src/daemon/types_list.c +++ b/src/daemon/types_list.c @@ -102,7 +102,7 @@ static void parse_line (char *buf) char *fields[64]; size_t fields_num; data_set_t *ds; - int i; + size_t i; fields_num = strsplit (buf, fields, 64); if (fields_num < 2) @@ -123,14 +123,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 #%i " + ERROR ("types_list: parse_line: Cannot parse data source #%zu " "of data set %s", i, ds->type); + sfree (ds->ds); + sfree (ds); return; }