]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix possible memory leak of switch_core_session_message_t in switch_core_sessi...
authorAndrey Volk <andywolk@gmail.com>
Fri, 22 Jan 2021 18:57:24 +0000 (21:57 +0300)
committerAndrey Volk <andywolk@gmail.com>
Wed, 17 Mar 2021 16:30:39 +0000 (19:30 +0300)
src/switch_core_session.c

index 36cf62f1112c8914d32877cc51883adbf85eda48..4dde4cba84a6b63c027f7fe20bf8173a1a38dfae 100644 (file)
@@ -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;