GNOME Bugzilla – Bug 496731
[PATCH] xvimagesink leaks memory if initialization fails
Last modified: 2007-11-16 11:17:02 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.
Created attachment 99082 [details] [review] Patch that fixes this memory leak
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.