From ba5d00054e24261b3b8cbbef56dc6e6ae54f61bc Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 25 Jun 2015 22:18:27 +0200 Subject: [PATCH] write_redis plugin: Call freeReplyObject() for each redisReply. --- src/write_redis.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/write_redis.c b/src/write_redis.c index 02663c66..2a6f9124 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -134,12 +134,19 @@ static int wr_write (const data_set_t *ds, /* {{{ */ } rr = redisCommand (node->conn, "ZADD %s %s %s", key, time, value); - if (rr==NULL) + if (rr == NULL) WARNING("ZADD command error. key:%s message:%s", key, node->conn->errstr); + else + freeReplyObject (rr); + /* TODO(octo): This is more overhead than necessary. Use the cache and + * metadata to determine if it is a new metric and call SADD only once for + * each metric. */ rr = redisCommand (node->conn, "SADD collectd/values %s", ident); if (rr==NULL) WARNING("SADD command error. ident:%s message:%s", ident, node->conn->errstr); + else + freeReplyObject (rr); pthread_mutex_unlock (&node->lock); -- 2.30.2