Code

amqp: malloc + memset -> calloc
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 28 Mar 2016 17:32:51 +0000 (19:32 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Mon, 28 Mar 2016 17:32:51 +0000 (19:32 +0200)
src/amqp.c

index 4206bdc1e3ee36b99192452b377943e007fb8af8..ec7943022b8db23177dae9e284e5a5fe6717abcf 100644 (file)
@@ -925,15 +925,14 @@ static int camqp_config_connection (oconfig_item_t *ci, /* {{{ */
     int status;
     int i;
 
-    conf = malloc (sizeof (*conf));
+    conf = calloc (1, sizeof (*conf));
     if (conf == NULL)
     {
-        ERROR ("amqp plugin: malloc failed.");
+        ERROR ("amqp plugin: calloc failed.");
         return (ENOMEM);
     }
 
     /* Initialize "conf" {{{ */
-    memset (conf, 0, sizeof (*conf));
     conf->publish = publish;
     conf->name = NULL;
     conf->format = CAMQP_FORMAT_COMMAND;