]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_mongo, mod_redis, mod_voicemail] Fix leaking hash iterators.
authorAndrey Volk <andywolk@gmail.com>
Thu, 19 Nov 2020 17:18:09 +0000 (21:18 +0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 17 Mar 2021 15:29:20 +0000 (18:29 +0300)
src/mod/applications/mod_mongo/mod_mongo.c
src/mod/applications/mod_redis/mod_redis.c
src/mod/applications/mod_voicemail/mod_voicemail.c

index aac3221fe7002b81f56bdd2cf4db691d1ce02156..b66b01369ada5a897945c8a32080bcd128cabf4e 100644 (file)
@@ -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);
index 7f140fe7d603572c9dee6b5286911400fa9c9330..5d4c132cd7264bfc5971f38082ba96235be3999f 100644 (file)
@@ -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);
index aba1dc4cf0f7947580423d648ac099ff4551fbd0..dd3a74a46307c9421f39098bf14ea596a01ccf87 100644 (file)
@@ -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);
                }