summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorcdliuqiang@gmail.com <cdliuqiang@gmail.com>2017-08-16 12:36:35 +0800
committerJan-Erik Rediger <janerik@fnordig.de>2018-01-05 16:19:54 +0100
commit9219556386a928f86ef38a36b081c7cf42d5e87a (patch)
tree20387a9e057735c39845e92887a0bc2c09f7314f /hiredis.c
parent43284ee4958dbc7996e293a215d99f0051356f37 (diff)
calloc param fixes and NULL check
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hiredis.c b/hiredis.c
index 3a7ab11..b344962 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -710,6 +710,8 @@ redisContext *redisConnectNonBlock(const char *ip, int port) {
redisContext *redisConnectBindNonBlock(const char *ip, int port,
const char *source_addr) {
redisContext *c = redisContextInit();
+ if (c == NULL)
+ return NULL;
c->flags &= ~REDIS_BLOCK;
redisContextConnectBindTcp(c,ip,port,NULL,source_addr);
return c;
@@ -718,6 +720,8 @@ redisContext *redisConnectBindNonBlock(const char *ip, int port,
redisContext *redisConnectBindNonBlockWithReuse(const char *ip, int port,
const char *source_addr) {
redisContext *c = redisContextInit();
+ if (c == NULL)
+ return NULL;
c->flags &= ~REDIS_BLOCK;
c->flags |= REDIS_REUSEADDR;
redisContextConnectBindTcp(c,ip,port,NULL,source_addr);