Delete MessageData when a message is posted to a quitting MessageQueue
Bug: webrtc:9913
Change-Id: Id60f537eb0049995c9f0837e3a03ca3a3dd90577
Reviewed-on: https://webrtc-review.googlesource.com/c/107639
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25365}
diff --git a/rtc_base/messagequeue.cc b/rtc_base/messagequeue.cc
index d710ba5..204952a 100644
--- a/rtc_base/messagequeue.cc
+++ b/rtc_base/messagequeue.cc
@@ -350,8 +350,10 @@
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 @@
uint32_t id,
MessageData* pdata) {
if (IsQuitting()) {
+ delete pdata;
return;
}