From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:16:28 +0000 (+0200) Subject: sigrok plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~16 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4a1ea15f79c8a7fbd362bb493fb98d52146b02fd;p=collectd.git sigrok plugin: malloc + memset -> calloc --- diff --git a/src/sigrok.c b/src/sigrok.c index 4e61f946..6c781f81 100644 --- a/src/sigrok.c +++ b/src/sigrok.c @@ -72,11 +72,10 @@ static int sigrok_config_device(oconfig_item_t *ci) struct config_device *cfdev; int i; - if (!(cfdev = malloc(sizeof(*cfdev)))) { - ERROR("sigrok plugin: malloc() failed."); + if (!(cfdev = calloc(1, sizeof(*cfdev)))) { + ERROR("sigrok plugin: calloc failed."); return -1; } - memset(cfdev, 0, sizeof(*cfdev)); if (cf_util_get_string(ci, &cfdev->name)) { free(cfdev); WARNING("sigrok plugin: Invalid device name.");