From: Andrey Volk Date: Fri, 22 Jan 2021 18:57:24 +0000 (+0300) Subject: [Core] Fix possible memory leak of switch_core_session_message_t in switch_core_sessi... X-Git-Tag: v1.10.6^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97930570dce98a436ce720ec00e886c8458979b9;p=thirdparty%2Ffreeswitch.git [Core] Fix possible memory leak of switch_core_session_message_t in switch_core_session_queue_indication() --- diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 36cf62f111..4dde4cba84 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1026,8 +1026,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core msg->message_id = indication; msg->from = __FILE__; switch_set_flag(msg, SCSMF_DYNAMIC); - switch_core_session_queue_message(session, msg); - return SWITCH_STATUS_SUCCESS; + + if (switch_core_session_queue_message(session, msg) == SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_SUCCESS; + } + + free(msg); } return SWITCH_STATUS_FALSE;