From 90c35685c315b0deb2413d623839e2f3641140a6 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 19 Nov 2020 21:18:09 +0400 Subject: [PATCH] [mod_mongo, mod_redis, mod_voicemail] Fix leaking hash iterators. --- src/mod/applications/mod_mongo/mod_mongo.c | 1 + src/mod/applications/mod_redis/mod_redis.c | 2 ++ src/mod/applications/mod_voicemail/mod_voicemail.c | 1 + 3 files changed, 4 insertions(+) diff --git a/src/mod/applications/mod_mongo/mod_mongo.c b/src/mod/applications/mod_mongo/mod_mongo.c index aac3221fe7..b66b01369a 100644 --- a/src/mod/applications/mod_mongo/mod_mongo.c +++ b/src/mod/applications/mod_mongo/mod_mongo.c @@ -698,6 +698,7 @@ SWITCH_LIMIT_RELEASE(mod_mongo_limit_release) if (mod_mongo_increment(session, (const char *)p_key, -1, 0, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Couldn't decrement %s\n", (const char *)p_key); status = SWITCH_STATUS_FALSE; + free(hi); break; } else { switch_core_hash_delete(pvt->resources, (const char *) p_key); diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index 7f140fe7d6..5d4c132cd7 100644 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -197,11 +197,13 @@ SWITCH_LIMIT_RELEASE(limit_release_redis) if (credis_decr(redis, (const char*)p_key, &val) != 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", (char *)p_key); + free(hi); switch_goto_status(SWITCH_STATUS_FALSE, end); } p_uuid_key = switch_core_session_sprintf(session, "%s_%s", switch_core_get_switchname(), (char *)p_key); if (credis_decr(redis,p_uuid_key,&uuid_val) != 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", p_uuid_key); + free(hi); switch_goto_status(SWITCH_STATUS_FALSE, end); } switch_core_hash_delete(pvt->hash, (const char *) p_key); diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index aba1dc4cf0..dd3a74a463 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3855,6 +3855,7 @@ SWITCH_STANDARD_API(boxcount_api_function) total_new_messages = total_saved_messages = 0; message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages, &total_new_urgent_messages, &total_saved_urgent_messages); + free(hi); } switch_mutex_unlock(globals.mutex); }