From 9b4e3b8771093faffc5a0310ae9c802231fdd557 Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 14 Aug 2018 19:40:21 +0300 Subject: [PATCH] Fixed freeing NULL rpl from REDIS server. Reported by @mrmeyers99 Closes #1442 (cherry picked from commit b33b7a7e71ce0b76a80c3abf430f572074869e22) --- modules/cachedb_redis/cachedb_redis_dbase.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/cachedb_redis/cachedb_redis_dbase.c b/modules/cachedb_redis/cachedb_redis_dbase.c index 1837717f95..3cbd04860f 100644 --- a/modules/cachedb_redis/cachedb_redis_dbase.c +++ b/modules/cachedb_redis/cachedb_redis_dbase.c @@ -137,7 +137,8 @@ int redis_connect(redis_con *con) if (rpl == NULL || rpl->type == REDIS_REPLY_ERROR) { LM_ERR("failed to auth to redis - %.*s\n", rpl?rpl->len:7,rpl?rpl->str:"FAILURE"); - freeReplyObject(rpl); + if (rpl!=NULL) + freeReplyObject(rpl); redisFree(ctx); return -1; } @@ -153,7 +154,8 @@ int redis_connect(redis_con *con) con->nodes = pkg_malloc(sizeof(cluster_node) + len + 1); if (con->nodes == NULL) { LM_ERR("no more pkg\n"); - freeReplyObject(rpl); + if (rpl!=NULL) + freeReplyObject(rpl); redisFree(ctx); return -1; } @@ -179,7 +181,8 @@ int redis_connect(redis_con *con) } } - freeReplyObject(rpl); + if (rpl!=NULL) + freeReplyObject(rpl); redisFree(ctx); con->flags |= REDIS_INIT_NODES;