[sr-dev] git:master: modules/ndb_redis: solved bug in second call to redisvCommand.

Vicente Hernando vhernando at systemonenoc.com
Thu Nov 28 12:17:23 CET 2013


Module: sip-router
Branch: master
Commit: 52a34d269931f6f3a50b3fc532405624b9e38d23
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=52a34d269931f6f3a50b3fc532405624b9e38d23

Author: Vicente Hernando <vhernando at systemonenoc.com>
Committer: Vicente Hernando <vhernando at systemonenoc.com>
Date:   Thu Nov 28 12:16:05 2013 +0100

modules/ndb_redis: solved bug in second call to redisvCommand.

---

 modules/ndb_redis/redis_client.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/ndb_redis/redis_client.c b/modules/ndb_redis/redis_client.c
index 0ba083a..6cf7f6f 100644
--- a/modules/ndb_redis/redis_client.c
+++ b/modules/ndb_redis/redis_client.c
@@ -316,9 +316,10 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
 	redisc_server_t *rsrv=NULL;
 	redisc_reply_t *rpl;
 	char c;
-	va_list ap;
+	va_list ap, ap2;
 
 	va_start(ap, cmd);
+	va_copy(ap2, ap);
 
 	rsrv = redisc_get_server(srv);
 	if(srv==NULL || cmd==NULL || res==NULL)
@@ -365,7 +366,7 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
 		}
 		if(redisc_reconnect_server(rsrv)==0)
 		{
-			rpl->rplRedis = redisvCommand(rsrv->ctxRedis, cmd->s, ap);
+			rpl->rplRedis = redisvCommand(rsrv->ctxRedis, cmd->s, ap2);
 		} else {
 			LM_ERR("unable to reconnect to redis server: %.*s\n", srv->len, srv->s);
 			cmd->s[cmd->len] = c;
@@ -374,10 +375,12 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
 	}
 	cmd->s[cmd->len] = c;
 	va_end(ap);
+	va_end(ap2);
 	return 0;
 
 error_exec:
 	va_end(ap);
+	va_end(ap2);
 	return -1;
 
 }




More information about the sr-dev mailing list