From: Michael Spiegle Date: Fri, 10 Jan 2014 00:48:47 +0000 (+0000) Subject: Fix memory leak in redis.c X-Git-Tag: collectd-5.5.0~139^2~4 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=cca6157fec10885c157ff6340b9b4d6bfcf5284f;p=collectd.git Fix memory leak in redis.c --- diff --git a/src/redis.c b/src/redis.c index 47e229e7..f1a88b29 100644 --- a/src/redis.c +++ b/src/redis.c @@ -278,9 +278,12 @@ static int redis_read (void) /* {{{ */ DEBUG ("redis plugin: authenticanting node `%s' passwd(%s).", rn->name, rn->passwd); rr = redisCommand (rh, "AUTH %s", rn->passwd); - if (rr == NULL || rr->type != 5) + if (rr == NULL || rr->type != REDIS_REPLY_STATUS) { WARNING ("redis plugin: unable to authenticate on node `%s'.", rn->name); + if (rr != NULL) + freeReplyObject (rr); + redisFree (rh); continue; } @@ -307,6 +310,7 @@ static int redis_read (void) /* {{{ */ redis_handle_info (rn->name, rr->str, "pubsub", "patterns", "pubsub_patterns", DS_TYPE_GAUGE); redis_handle_info (rn->name, rr->str, "current_connections", "slaves", "connected_slaves", DS_TYPE_GAUGE); + freeReplyObject (rr); redisFree (rh); }