From: Ruben Kerkhof Date: Fri, 1 Apr 2016 16:33:34 +0000 (+0200) Subject: varnish plugin: malloc + memset -> calloc X-Git-Tag: collectd-5.6.0~371^2~8 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=89609e324696790276c494bee774a30e2d9dc3c8;p=collectd.git varnish plugin: malloc + memset -> calloc --- diff --git a/src/varnish.c b/src/varnish.c index aee72471..d7da95a3 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -943,10 +943,9 @@ static int varnish_init (void) /* {{{ */ if (have_instance) return (0); - conf = malloc (sizeof (*conf)); + conf = calloc (1, sizeof (*conf)); if (conf == NULL) return (ENOMEM); - memset (conf, 0, sizeof (*conf)); /* Default settings: */ conf->instance = NULL; @@ -972,10 +971,9 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */ char callback_name[DATA_MAX_NAME_LEN]; int i; - conf = malloc (sizeof (*conf)); + conf = calloc (1, sizeof (*conf)); if (conf == NULL) return (ENOMEM); - memset (conf, 0, sizeof (*conf)); conf->instance = NULL; varnish_config_apply_default (conf);