Commit 3f6bd266 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

msg_Unsubscribe: race condition memory leak

parent cf08617d
...@@ -275,6 +275,15 @@ void msg_Unsubscribe (msg_subscription_t *sub) ...@@ -275,6 +275,15 @@ void msg_Unsubscribe (msg_subscription_t *sub)
vlc_mutex_unlock (&bank->lock); vlc_mutex_unlock (&bank->lock);
vlc_join (sub->thread, NULL); vlc_join (sub->thread, NULL);
/* Free dangling (not flushed) messages. */
/* NOTE: no locking, only this thread can refer to the subscription now. */
while (sub->begin != sub->end)
{
msg_Release (sub->items[sub->begin]);
if (++sub->begin == VLC_MSG_QSIZE)
sub->begin = 0;
}
free (sub); free (sub);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment