From 58b2eba17c126e5ae0811ad0935f49cd1d8f1453 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 1 Apr 2016 17:59:27 +0200 Subject: [PATCH] nut plugin: malloc + memset -> calloc --- src/nut.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); -- 2.11.0