diff --git a/rtc_base/messagequeue.cc b/rtc_base/messagequeue.cc index d710ba58a4..204952a7e2 100644 --- a/rtc_base/messagequeue.cc +++ b/rtc_base/messagequeue.cc @@ -350,8 +350,10 @@ void MessageQueue::Post(const Location& posted_from, uint32_t id, MessageData* pdata, bool time_sensitive) { - if (IsQuitting()) + if (IsQuitting()) { + delete pdata; return; + } // Keep thread safe // Add the message to the end of the queue @@ -407,6 +409,7 @@ void MessageQueue::DoDelayPost(const Location& posted_from, uint32_t id, MessageData* pdata) { if (IsQuitting()) { + delete pdata; return; }