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: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58b2eba17c126e5ae0811ad0935f49cd1d8f1453;p=thirdparty%2Fcollectd.git nut plugin: malloc + memset -> calloc --- diff --git a/src/nut.c b/src/nut.c index 9540d7c47..17eb1b9ab 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);