X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Famqp.c;h=fc69e936554a6418b7be9d05784c7bba798a2a13;hb=db35efb33e81d0a013e09a8a6ffa362ad5962f7c;hp=4206bdc1e3ee36b99192452b377943e007fb8af8;hpb=3aeca36659b04725028f123bcea387a37581624a;p=collectd.git diff --git a/src/amqp.c b/src/amqp.c index 4206bdc1..fc69e936 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -736,7 +736,7 @@ static int camqp_subscribe_init (camqp_config_t *conf) /* {{{ */ if (tmp == NULL) { ERROR ("amqp plugin: realloc failed."); - camqp_config_free (conf); + sfree (subscriber_threads); return (ENOMEM); } subscriber_threads = tmp; @@ -750,7 +750,6 @@ static int camqp_subscribe_init (camqp_config_t *conf) /* {{{ */ char errbuf[1024]; ERROR ("amqp plugin: pthread_create failed: %s", sstrerror (status, errbuf, sizeof (errbuf))); - camqp_config_free (conf); return (status); } @@ -925,15 +924,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;