Skip to content

Commit

Permalink
Fixed freeing NULL rpl from REDIS server.
Browse files Browse the repository at this point in the history
Reported by @mrmeyers99
Closes #1442

(cherry picked from commit b33b7a7)
  • Loading branch information
bogdan-iancu committed Aug 14, 2018
1 parent f6219b7 commit 9b4e3b8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/cachedb_redis/cachedb_redis_dbase.c
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -179,7 +181,8 @@ int redis_connect(redis_con *con)
}
}

freeReplyObject(rpl);
if (rpl!=NULL)
freeReplyObject(rpl);
redisFree(ctx);

con->flags |= REDIS_INIT_NODES;
Expand Down

0 comments on commit 9b4e3b8

Please sign in to comment.