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}
This commit is contained in:
Niels Möller
2018-10-24 15:13:07 +02:00
committed by Commit Bot
parent 9516c38538
commit 4ba6c26623

View File

@ -350,8 +350,10 @@ void MessageQueue::Post(const Location& posted_from,
uint32_t id, uint32_t id,
MessageData* pdata, MessageData* pdata,
bool time_sensitive) { bool time_sensitive) {
if (IsQuitting()) if (IsQuitting()) {
delete pdata;
return; return;
}
// Keep thread safe // Keep thread safe
// Add the message to the end of the queue // Add the message to the end of the queue
@ -407,6 +409,7 @@ void MessageQueue::DoDelayPost(const Location& posted_from,
uint32_t id, uint32_t id,
MessageData* pdata) { MessageData* pdata) {
if (IsQuitting()) { if (IsQuitting()) {
delete pdata;
return; return;
} }