Browse Source

ndb_redis: clean up previous redis reply

Daniel-Constantin Mierla 14 years ago
parent
commit
2e835b6bed
1 changed files with 6 additions and 0 deletions
  1. 6 0
      modules/ndb_redis/redis_client.c

+ 6 - 0
modules/ndb_redis/redis_client.c

@@ -207,6 +207,12 @@ int redisc_exec(str *srv, str *cmd, str *argv1, str *argv2, str *argv3,
 		LM_ERR("no redis reply id found: %.*s\n", res->len, res->s);
 		LM_ERR("no redis reply id found: %.*s\n", res->len, res->s);
 		return -1;
 		return -1;
 	}
 	}
+	if(rpl->rplRedis!=NULL)
+	{
+		/* clean up previous redis reply */
+		freeReplyObject(rpl->rplRedis);
+		rpl->rplRedis = NULL;
+	}
 	c = cmd->s[cmd->len];
 	c = cmd->s[cmd->len];
 	cmd->s[cmd->len] = '\0';
 	cmd->s[cmd->len] = '\0';
 	rpl->rplRedis = redisCommand(rsrv->ctxRedis, cmd->s);
 	rpl->rplRedis = redisCommand(rsrv->ctxRedis, cmd->s);