Browse Source

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

(cherry picked from commit 52a34d269931f6f3a50b3fc532405624b9e38d23)
Vicente Hernando 11 years ago
parent
commit
424711ec88
1 changed files with 5 additions and 2 deletions
  1. 5 2
      modules/ndb_redis/redis_client.c

+ 5 - 2
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;
 
 }