From: Ruben Kerkhof Date: Sat, 5 Dec 2015 10:47:46 +0000 (+0100) Subject: write_sensu plugin: fix two resource leaks on error X-Git-Tag: collectd-5.5.1~30 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a850c51972ef63605de7b3dc9a95cf2a766c7621;p=collectd.git write_sensu plugin: fix two resource leaks on error CID #37999 Signed-off-by: Florian Forster --- diff --git a/src/write_sensu.c b/src/write_sensu.c index f7803e86..507018fd 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -680,6 +680,7 @@ static char *sensu_notification_to_json(struct sensu_host *host, /* {{{ */ char *handlers_str = build_json_str_list("handlers", &(host->notification_handlers)); if (handlers_str == NULL) { ERROR("write_sensu plugin: Unable to alloc memory"); + free(ret_str); return NULL; } // incorporate the handlers @@ -781,6 +782,7 @@ static char *sensu_notification_to_json(struct sensu_host *host, /* {{{ */ char *msg = replace_json_reserved(n->message); if (msg == NULL) { ERROR("write_sensu plugin: Unable to alloc memory"); + free(ret_str); return NULL; } res = asprintf(&temp_str, "%s, \"output\": \"%s - %s\"", ret_str, severity, msg);