Ver Fonte

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

Claudiu Boriga há 8 anos atrás
pai
commit
26b072c7c8
1 ficheiros alterados com 6 adições e 0 exclusões
  1. 6 0
      src/modules/ndb_redis/redis_client.c

+ 6 - 0
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");