Less surprising behaviour.
Make redisFree() and freeReplyObject() less surprising by behaving just like free(). That is, don't crash when passing in NULL.
This commit is contained in:
parent
f225c276be
commit
05b85ebe7f
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user