From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:20:59 +0000 (+0200) Subject: tail_csv: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~13 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=911f433f61c75d738e23c3475e95682031b311ca;p=collectd.git tail_csv: malloc + memset -> calloc --- diff --git a/src/tail_csv.c b/src/tail_csv.c index 15c083ea..2d794fc7 100644 --- a/src/tail_csv.c +++ b/src/tail_csv.c @@ -290,10 +290,9 @@ static int tcsv_config_add_metric(oconfig_item_t *ci){ int status; int i; - md = malloc(sizeof(*md)); + md = calloc(1, sizeof(*md)); if (md == NULL) return (-1); - memset(md, 0, sizeof(*md)); md->name = NULL; md->type = NULL; md->instance = NULL; @@ -426,10 +425,9 @@ static int tcsv_config_add_file(oconfig_item_t *ci) char cb_name[DATA_MAX_NAME_LEN]; user_data_t cb_data; - id = malloc(sizeof(*id)); + id = calloc(1, sizeof(*id)); if (id == NULL) return (-1); - memset(id, 0, sizeof(*id)); id->instance = NULL; id->path = NULL; id->metric_list = NULL;