GNOME Bugzilla – Bug 573288
[mpegtsdemux] memory leak when pusi is missed due to packet lost
Last modified: 2009-02-28 18:42:46 UTC
Please describe the problem: When demuxing a stream from an unreliable UDP source, if packet losses causes the filter to miss the pusi bit, some buffers entering gst_section_filter_push will leak. There is an obvious exit point in this function where the buffer is not handled. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 129579 [details] [review] Proposed fix for memory leak Proposed fix is pretty straight forward, simply add a gst_buffer_unref in the 3rd exit point of the function gst_section_filter_push.
Looking back at the code I just noticed there are 2 more exit points to this function : 124: g_return_val_if_fail (filter != NULL, FALSE); 138: if (filter->section_length > 1021) { 139: GST_DEBUG ("section length too big"); 140: return FALSE; 141: } Maybe a goto label should be used to handle all these exceptions.
Created attachment 129652 [details] [review] Complete solution with goto label I've observed that a leak is possible when the other two exit points are not covered. I'm not a fan of using gotos but this simplifies the fix a lot without completely rewriting the function.
commit 38dd0f6410fc170035194eaee2e520e88cf42adc Author: vanista <vanista@gmail.com> Date: Sat Feb 28 19:41:10 2009 +0100 mpegtsdemux: Fix memory leaks when PUSI is missed due to packet loss Fixes bug #573288.