]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11823 [core] clear out event queue when destroying session
authorChris Rienzo <chris@signalwire.com>
Tue, 30 Apr 2019 18:50:34 +0000 (18:50 +0000)
committerMike Jerris <mike@signalwire.com>
Thu, 6 Jun 2019 15:20:16 +0000 (11:20 -0400)
src/switch_core_session.c

index 3084fd5481eef256d77470887641c66dc090f786..8a4ca0663a82b99f7319f25c0d2c2afbf7fed4a1 100644 (file)
@@ -1580,6 +1580,17 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
                }
        }
 
+       if ((*session)->event_queue) {
+               switch_status_t status;
+               void *pop;
+               while ((status = (switch_status_t) switch_queue_trypop((*session)->event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
+                       if (pop) {
+                               switch_event_t *event = (switch_event_t *) pop;
+                               switch_event_destroy(&event);
+                       }
+               }
+       }
+
        pool = (*session)->pool;
        //#ifndef NDEBUG
        //memset(*session, 0, sizeof(switch_core_session_t));