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 496731 - [PATCH] xvimagesink leaks memory if initialization fails
[PATCH] xvimagesink leaks memory if initialization fails
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 0.10.16
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-11-14 12:49 UTC by Tommi Myöhänen
Modified: 2007-11-16 11:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that fixes this memory leak (896 bytes, patch)
2007-11-14 12:50 UTC, Tommi Myöhänen
committed Details | Review

Description Tommi Myöhänen 2007-11-14 12:49:07 UTC
Valgrind tells following (line numbers might differ, since I am not running the CVS version in my test environment):

==24003== 20 bytes in 1 blocks are definitely lost in loss record 1 of 24
==24003==    at 0x4021B52: calloc (vg_replace_malloc.c:279)
==24003==    by 0x4280E14: g_malloc0 (in /targets/OSSO_1.1_X86/usr/lib/libglib-2.0.so.0.1200.12)
==24003==    by 0x77701CE: gst_xvimagesink_calculate_pixel_aspect_ratio (xvimagesink.c:1588)
==24003==    by 0x7770719: gst_xvimagesink_xcontext_get (xvimagesink.c:1645)
==24003==    by 0x77720CE: gst_xvimagesink_change_state (xvimagesink.c:2081)
==24003==    by 0x4058DDF: gst_element_change_state (gstelement.c:2362)
==24003==    by 0x4059475: gst_element_set_state_func (gstelement.c:2312)
==24003==    by 0x4057D24: gst_element_set_state (gstelement.c:2218)
==24003==    by 0x45FBBD8: (within /targets/OSSO_1.1_X86/usr/lib/gstreamer-0.10/libgstautodetect.so)
==24003==    by 0x4058DDF: gst_element_change_state (gstelement.c:2362)
==24003==    by 0x4059475: gst_element_set_state_func (gstelement.c:2312)
==24003==    by 0x4057D24: gst_element_set_state (gstelement.c:2218)

This is because gst_xvimagesink_calculate_pixel_aspect_ratio() creates par GValue that is not freed if initialization fails later on. Attached is a patch that fixes this issue.
Comment 1 Tommi Myöhänen 2007-11-14 12:50:24 UTC
Created attachment 99082 [details] [review]
Patch that fixes this memory leak
Comment 2 Wim Taymans 2007-11-16 11:17:02 UTC
        Patch by: Tommi Myöhänen <ext-tommi dot myohanen at nokia dot com>

        * sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
        (gst_ximagesink_change_state):
        * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get):
        Don't leak the PAR on errors. Fixes #496731.