summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2014-05-29 08:20:43 -0700
committerPieter Noordhuis <pcnoordhuis@gmail.com>2014-05-29 08:20:43 -0700
commit2602e1b6bc19dc191df0c50cd6502578fe492710 (patch)
treeb82713f87b1a8156e4a46ca14f1b25b3ae314a20 /hiredis.c
parentf225c276be7fd0646019b51023e3f41566633dfe (diff)
parent21a1207ae13f3d422fb99669019836da3422b784 (diff)
Merge pull request #246 from dmelani/master
Less surprising behaviour in redisFree() and freeReplyObject()
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hiredis.c b/hiredis.c
index 2afee56..78beaae 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -73,6 +73,9 @@ void freeReplyObject(void *reply) {
redisReply *r = reply;
size_t j;
+ if (r == NULL)
+ return;
+
switch(r->type) {
case REDIS_REPLY_INTEGER:
break; /* Nothing to free */
@@ -1001,6 +1004,8 @@ static redisContext *redisContextInit(void) {
}
void redisFree(redisContext *c) {
+ if (c == NULL)
+ return;
if (c->fd > 0)
close(c->fd);
if (c->obuf != NULL)