Bug 113762

Summary: [GStreamer] Memory leaks in MediaPlayerPrivateGStreamer
Product: WebKit Reporter: Sudarsana Nagineni (babu) <naginenis>
Component: WebKitGTKAssignee: Sudarsana Nagineni (babu) <naginenis>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, feature-media-reviews, gns, jer.noble, menard, mrobinson, pnormand, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Sudarsana Nagineni (babu) 2013-04-02 02:18:26 PDT
strings returned by gst_element_get_name() and gst_missing_plugin_message_get_installer_detail() must be freed to avoid memory leaks.

1)
==21665== 99 bytes in 3 blocks are definitely lost in loss record 24,564 of 34,507
==21665==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==21665==    by 0xD3E18D8: g_malloc (gmem.c:159)
==21665==    by 0xD3F76FD: g_strdup (gstrfuncs.c:364)
==21665==    by 0xB6693CC: gst_object_get_name (gstobject.c:657)
==21665==    by 0x6F08280: WebCore::MediaPlayerPrivateGStreamer::setAudioStreamProperties(_GObject*) (MediaPlayerPrivateGStreamer.cpp:151)
==21665==    by 0x6F080B8: WebCore::setAudioStreamPropertiesCallback(_GstChildProxy*, _GObject*, char*, WebCore::MediaPlayerPrivateGStreamer*) (MediaPlayerPrivateGStreamer.cpp:125)
==21665==    by 0x127ABF97: ffi_call_unix64 (in /home/sudarsana/Webkit/gtk/WebKit/WebKitBuild/Dependencies/Root/lib64/libffi.so.5.0.10)
==21665==    by 0x127AB93C: ffi_call (ffi64.c:486)

2)
==21665==
==21665== 384 bytes in 2 blocks are definitely lost in loss record 30,965 of 34,507
==21665==    at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==21665==    by 0xD3E1996: g_realloc (gmem.c:224)
==21665==    by 0xD3F9A26: g_string_maybe_expand (gstring.c:107)
==21665==    by 0xD3FAE66: g_string_append_vprintf (gstring.c:1168)
==21665==    by 0xD3FB066: g_string_append_printf (gstring.c:1268)
==21665==    by 0x414F0DF: gst_missing_plugin_message_get_installer_detail (missing-plugins.c:467)
==21665==    by 0x6F0B8DF: WebCore::MediaPlayerPrivateGStreamer::handleMessage(_GstMessage*) (MediaPlayerPrivateGStreamer.cpp:780)
==21665==    by 0x6F07FEC: WebCore::mediaPlayerPrivateMessageCallback(_GstBus*, _GstMessage*, WebCore::MediaPlayerPrivateGStreamer*) (MediaPlayerPrivateGStreamer.cpp:88)
Comment 1 Sudarsana Nagineni (babu) 2013-04-02 09:30:09 PDT
Created attachment 196162 [details]
Patch
Comment 2 Philippe Normand 2013-04-02 09:44:12 PDT
Comment on attachment 196162 [details]
Patch

Thanks!
Comment 3 Philippe Normand 2013-04-02 09:45:31 PDT
BTW I know these leaks are programming errors but perhaps it would be interesting to have a debug EWS bot running valgrind on patches pending-review. What do you think about that?
Comment 4 Sudarsana Nagineni (babu) 2013-04-02 12:49:42 PDT
(In reply to comment #3)
> BTW I know these leaks are programming errors but perhaps it would be interesting to have a debug EWS bot running valgrind on patches pending-review. What do you think about that?

This is exactly what I have been thinking. I'm going to spend some time trying to setup the leak bot.
Comment 5 WebKit Review Bot 2013-04-02 13:02:24 PDT
Comment on attachment 196162 [details]
Patch

Clearing flags on attachment: 196162

Committed r147490: <http://trac.webkit.org/changeset/147490>
Comment 6 WebKit Review Bot 2013-04-02 13:02:28 PDT
All reviewed patches have been landed.  Closing bug.