Module: sip-router Branch: master Commit: 4b60f510b3fe4ac8ff8fa2721cc40b18b93ed5d1 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4b60f510...
Author: Vicente Hernando vhernando@systemonenoc.com Committer: Vicente Hernando vhernando@systemonenoc.com Date: Mon Aug 27 16:22:35 2012 -0400
ndb_redis: add some error checks in redisc_exec function.
---
modules/ndb_redis/redis_client.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/modules/ndb_redis/redis_client.c b/modules/ndb_redis/redis_client.c index 72354a6..0bf2c37 100644 --- a/modules/ndb_redis/redis_client.c +++ b/modules/ndb_redis/redis_client.c @@ -326,6 +326,11 @@ int redisc_exec(str *srv, str *res, str *cmd, ...) LM_ERR("invalid parameters"); goto error_exec; } + if(srv->len==0 || res->len==0 || cmd->len==0) + { + LM_ERR("invalid parameters"); + goto error_exec; + } if(rsrv==NULL) { LM_ERR("no redis server found: %.*s\n", srv->len, srv->s); @@ -354,6 +359,10 @@ int redisc_exec(str *srv, str *res, str *cmd, ...) if(rpl->rplRedis == NULL) { /* null reply, reconnect and try again */ + if(rsrv->ctxRedis->err) + { + LM_ERR("Redis error: %s\n", rsrv->ctxRedis->errstr); + } if(redisc_reconnect_server(rsrv)==0) { rpl->rplRedis = redisvCommand(rsrv->ctxRedis, cmd->s, ap);