GNOME Bugzilla – Bug 757974
glcolorconvert: Fix memory leak while running glcolorconvert test
Last modified: 2015-11-12 10:30:06 UTC
While running gstglcolorconvert tests using valgrind found the below memory leaks ==5542== 8,550 bytes in 90 blocks are definitely lost in loss record 1,666 of 1,675 ==5542== at 0x402E324: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==5542== by 0x4481285: __vasprintf_chk (vasprintf_chk.c:88) ==5542== by 0x42E8689: g_vasprintf (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42C1FF2: g_strdup_vprintf (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42C2022: g_strdup_printf (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x405AFC9: _do_convert (gstglcolorconvert.c:1039) ==5542== by 0x404713F: _gst_gl_context_thread_run_generic (gstglcontext.c:1456) ==5542== by 0x40601EA: _run_message_sync (gstglwindow.c:628) ==5542== by 0x4060151: _run_message_async (gstglwindow.c:697) ==5542== by 0x42A0C4F: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42A40A6: g_main_context_dispatch (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42A4467: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42A476A: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x4060263: gst_gl_window_default_run (gstglwindow.c:537) ==5542== by 0x4060968: gst_gl_window_run (gstglwindow.c:558) ==5542== by 0x4049D97: gst_gl_context_create_thread (gstglcontext.c:1224) ==5542== by 0x42CA9A9: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x4370F6F: start_thread (pthread_create.c:312) ==5542== by 0x4471BED: clone (clone.S:129) ==5542== ==5542== 46,080 bytes in 90 blocks are definitely lost in loss record 1,671 of 1,675 ==5542== at 0x402C17C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==5542== by 0x402E3AF: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==5542== by 0x42A9CB8: g_realloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42C42F6: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42C4346: g_string_sized_new (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42B8EA1: g_regex_replace_eval (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42B922D: g_regex_replace_literal (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x4058FF5: _mangle_shader (gstglcolorconvert.c:1525) ==5542== by 0x405A3F8: _do_convert (gstglcolorconvert.c:1654) ==5542== by 0x404713F: _gst_gl_context_thread_run_generic (gstglcontext.c:1456) ==5542== by 0x40601EA: _run_message_sync (gstglwindow.c:628) ==5542== by 0x4060151: _run_message_async (gstglwindow.c:697) ==5542== by 0x42A0C4F: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42A40A6: g_main_context_dispatch (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42A4467: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x42A476A: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==5542== by 0x4060263: gst_gl_window_default_run (gstglwindow.c:537) ==5542== by 0x4060968: gst_gl_window_run (gstglwindow.c:558) ==5542== by 0x4049D97: gst_gl_context_create_thread (gstglcontext.c:1224) ==5542== by 0x42CA9A9: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
Created attachment 315307 [details] [review] fix memory leaks
Created attachment 315308 [details] [review] Fix string leak Another leak found ==17255== 360 bytes in 90 blocks are definitely lost in loss record 1,651 of 1,673 ==17255== at 0x402C17C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==17255== by 0x42A9BE2: g_malloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==17255== by 0x42C1E1C: g_strdup (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==17255== by 0x4056E6F: gst_glsl_version_profile_to_string (gstglsl.c:206) ==17255== by 0x405A215: _do_convert (gstglcolorconvert.c:1599) ==17255== by 0x404713F: _gst_gl_context_thread_run_generic (gstglcontext.c:1456) ==17255== by 0x406021A: _run_message_sync (gstglwindow.c:628) ==17255== by 0x4060181: _run_message_async (gstglwindow.c:697) ==17255== by 0x42A0C4F: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==17255== by 0x42A40A6: g_main_context_dispatch (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==17255== by 0x42A4467: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==17255== by 0x42A476A: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==17255== by 0x4060293: gst_gl_window_default_run (gstglwindow.c:537) ==17255== by 0x4060998: gst_gl_window_run (gstglwindow.c:558) ==17255== by 0x4049D97: gst_gl_context_create_thread (gstglcontext.c:1224) ==17255== by 0x42CA9A9: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==17255== by 0x4370F6F: start_thread (pthread_create.c:312) ==17255== by 0x4471BED: clone (clone.S:129)
Created attachment 315309 [details] [review] remove unnecessary free.
Created attachment 315310 [details] [review] fix vertex_sources leak Another leak!!! ==2407== 720 bytes in 90 blocks are definitely lost in loss record 1,656 of 1,673 ==2407== at 0x402E109: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==2407== by 0x42A9C4A: g_malloc0 (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==2407== by 0x4057985: _compile_shader (gstglslstage.c:400) ==2407== by 0x404713F: _gst_gl_context_thread_run_generic (gstglcontext.c:1456) ==2407== by 0x406023A: _run_message_sync (gstglwindow.c:628) ==2407== by 0x40601A1: _run_message_async (gstglwindow.c:697) ==2407== by 0x42A5344: g_main_context_invoke_full (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==2407== by 0x42A549A: g_main_context_invoke (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0) ==2407== by 0x4060171: gst_gl_window_default_send_message_async (gstglwindow.c:718) ==2407== by 0x4060CEB: gst_gl_window_send_message_async (gstglwindow.c:745) ==2407== by 0x4060D72: gst_gl_window_default_send_message (gstglwindow.c:647) ==2407== by 0x4060C13: gst_gl_window_send_message (gstglwindow.c:683) ==2407== by 0x4048BCF: gst_gl_context_thread_add (gstglcontext.c:1493) ==2407== by 0x4058732: gst_glsl_stage_compile (gstglslstage.c:506) ==2407== by 0x405521F: gst_gl_shader_compile_attach_stage (gstglshader.c:544) ==2407== by 0x405A4AF: _do_convert (gstglcolorconvert.c:1678) ==2407== by 0x404713F: _gst_gl_context_thread_run_generic (gstglcontext.c:1456) ==2407== by 0x406023A: _run_message_sync (gstglwindow.c:628) ==2407== by 0x40601A1: _run_message_async (gstglwindow.c:697) ==2407== by 0x42A0C4F: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
commit 550ecade4ddff1da21743116c0eb26bbc843e1d6 Author: Vineeth TM <vineeth.tm@samsung.com> Date: Thu Nov 12 16:36:03 2015 +0900 glslstage: Fix vertex_sources memory leak vertex_sources is being allocated but not freed resulting in leak https://bugzilla.gnome.org/show_bug.cgi?id=757974 commit 591401f9e8293c257e2d6d89b027bebc527df09a Author: Vineeth TM <vineeth.tm@samsung.com> Date: Thu Nov 12 16:26:00 2015 +0900 glcolorconvert: remove unnecessary free version_str is already being freed. So no need to call again https://bugzilla.gnome.org/show_bug.cgi?id=757974 commit ba4802e1e57364975f09f471735d409c2b89fc73 Author: Vineeth TM <vineeth.tm@samsung.com> Date: Thu Nov 12 16:18:35 2015 +0900 glcolorconvert: Fix string leak String got using gst_glsl_version_profile_to_string, is allocated memory and should be freed https://bugzilla.gnome.org/show_bug.cgi?id=757974 commit b8adc98ddcc6f9e3f00578948b3a604c2416c07c Author: Vineeth TM <vineeth.tm@samsung.com> Date: Thu Nov 12 16:02:45 2015 +0900 glcolorconvert: Fix frag_prog and frag_body memory leak https://bugzilla.gnome.org/show_bug.cgi?id=757974