[sr-dev] git:master:26b072c7: ndb_redis: fix memory leak

Claudiu Boriga paul.boriga at 1and1.ro
Tue May 2 17:48:57 CEST 2017


Module: kamailio
Branch: master
Commit: 26b072c7c84c03d034cd31cd80ef2d78ecb76dce
URL: https://github.com/kamailio/kamailio/commit/26b072c7c84c03d034cd31cd80ef2d78ecb76dce

Author: Claudiu Boriga <paul.boriga at 1and1.ro>
Committer: Claudiu Boriga <paul.boriga at 1and1.ro>
Date: 2017-05-02T17:55:01+03:00

ndb_redis: fix memory leak
  - fix memory leak when re-using a reply-id

---

Modified: src/modules/ndb_redis/redis_client.c

---

Diff:  https://github.com/kamailio/kamailio/commit/26b072c7c84c03d034cd31cd80ef2d78ecb76dce.diff
Patch: https://github.com/kamailio/kamailio/commit/26b072c7c84c03d034cd31cd80ef2d78ecb76dce.patch

---

diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index 4998e65..4ebdeb1 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -599,6 +599,12 @@ int redisc_exec_pipelined(redisc_server_t *rsrv)
 	for (i=1;i<rsrv->piped.pending_commands;i++)
 	{
 		rpl=rsrv->piped.replies[i];
+		if(rpl->rplRedis!=NULL)
+		{
+			/* clean up previous redis reply */
+			freeReplyObject(rpl->rplRedis);
+			rpl->rplRedis = NULL;
+		}
 		if (redisGetReplyFromReader(rsrv->ctxRedis, (void**) &rpl->rplRedis) != REDIS_OK)
 		{
 			LM_ERR("Unable to read reply\n");




More information about the sr-dev mailing list