From: Pavel Rochnyack Date: Tue, 19 Jun 2018 16:19:34 +0000 (+0700) Subject: redis plugin: Fix memleak X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9ea20c99eadea54a7cb4efb51e2f6e06e4187915;p=collectd.git redis plugin: Fix memleak --- diff --git a/src/redis.c b/src/redis.c index 23234b83..36f57b09 100644 --- a/src/redis.c +++ b/src/redis.c @@ -316,8 +316,12 @@ static int redis_init(void) /* {{{ */ rn->name = strdup("default"); rn->host = strdup(REDIS_DEF_HOST); - if (rn->name == NULL || rn->host == NULL) + if (rn->name == NULL || rn->host == NULL) { + sfree(rn->name); + sfree(rn->host); + sfree(rn); return ENOMEM; + } return redis_node_add(rn); } /* }}} int redis_init */