diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-10-07 17:38:56 +0200 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-10-07 17:38:56 +0200 |
commit | b60952f22ade00bebd08530e568ed31eeadd8797 (patch) | |
tree | 831d6415531996d151019d6ffd50505f90b6368d | |
parent | 9cd3b03d84d5738cc08267782e999048cad0fb5e (diff) |
Disconnect before free'ing
-rw-r--r-- | hiredis.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -594,6 +594,11 @@ void redisDisconnect(redisContext *c) { } void redisFree(redisContext *c) { + /* Disconnect before free'ing if not yet disconnected. */ + if (c->flags & REDIS_CONNECTED) + redisDisconnect(c); + + /* Fire free callback and clear all allocations. */ if (c->cbFree != NULL) c->cbFree(c,c->privdataFree); if (c->error != NULL) |