After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 573288 - [mpegtsdemux] memory leak when pusi is missed due to packet lost
[mpegtsdemux] memory leak when pusi is missed due to packet lost
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 0.10.11
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-26 16:23 UTC by vanista
Modified: 2009-02-28 18:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix for memory leak (501 bytes, patch)
2009-02-26 16:26 UTC, vanista
none Details | Review
Complete solution with goto label (1.26 KB, patch)
2009-02-27 13:34 UTC, vanista
committed Details | Review

Description vanista 2009-02-26 16:23:18 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:
Comment 1 vanista 2009-02-26 16:26:22 UTC
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.
Comment 2 vanista 2009-02-26 20:10:06 UTC
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.

Comment 3 vanista 2009-02-27 13:34:55 UTC
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.
Comment 4 Sebastian Dröge (slomo) 2009-02-28 18:42:46 UTC
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.