Module: kamailio
Branch: master
Commit: 6daafa0c83a55db4064e3f816d224283f5c0c563
URL:
https://github.com/kamailio/kamailio/commit/6daafa0c83a55db4064e3f816d22428…
Author: Richard Fuchs <rfuchs(a)sipwise.com>
Committer: Richard Fuchs <rfuchs(a)sipwise.com>
Date: 2018-09-28T17:42:11-04:00
db_redis: fix reconnection failure bug
---
Modified: src/modules/db_redis/redis_connection.c
Modified: src/modules/db_redis/redis_connection.h
---
Diff:
https://github.com/kamailio/kamailio/commit/6daafa0c83a55db4064e3f816d22428…
Patch:
https://github.com/kamailio/kamailio/commit/6daafa0c83a55db4064e3f816d22428…
---
diff --git a/src/modules/db_redis/redis_connection.c
b/src/modules/db_redis/redis_connection.c
index 2720c2753d..e030472d9e 100644
--- a/src/modules/db_redis/redis_connection.c
+++ b/src/modules/db_redis/redis_connection.c
@@ -392,7 +392,7 @@ void db_redis_free_reply(redisReply **reply) {
void db_redis_consume_replies(km_redis_con_t *con) {
redisReply *reply = NULL;
redis_key_t *query;
- while (con->append_counter > 0 && !con->con->err) {
+ while (con->append_counter > 0 && con->con &&
!con->con->err) {
LM_DBG("consuming outstanding reply %u", con->append_counter);
db_redis_get_reply(con, (void**)&reply);
if (reply) {
diff --git a/src/modules/db_redis/redis_connection.h
b/src/modules/db_redis/redis_connection.h
index 7b6a836b5e..b137d80e6b 100644
--- a/src/modules/db_redis/redis_connection.h
+++ b/src/modules/db_redis/redis_connection.h
@@ -39,6 +39,8 @@
if (!(reply)) { \
LM_ERR("Failed to fetch type entry: %s\n", \
(con)->con->errstr); \
+ redisFree((con)->con); \
+ (con)->con = NULL; \
goto err; \
} \
if ((reply)->type == REDIS_REPLY_ERROR) { \