From: Ruben Kerkhof Date: Fri, 1 Apr 2016 15:59:27 +0000 (+0200) Subject: nut plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=58b2eba17c126e5ae0811ad0935f49cd1d8f1453;p=collectd.git nut plugin: malloc + memset -> calloc --- diff --git a/src/nut.c b/src/nut.c index 9540d7c4..17eb1b9a 100644 --- a/src/nut.c +++ b/src/nut.c @@ -80,13 +80,12 @@ static int nut_add_ups (const char *name) DEBUG ("nut plugin: nut_add_ups (name = %s);", name); - ups = malloc (sizeof (*ups)); + ups = calloc (1, sizeof (*ups)); if (ups == NULL) { - ERROR ("nut plugin: nut_add_ups: malloc failed."); + ERROR ("nut plugin: nut_add_ups: calloc failed."); return (1); } - memset (ups, '\0', sizeof (nut_ups_t)); status = upscli_splitname (name, &ups->upsname, &ups->hostname, &ups->port);