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 514573 - multipartmux memory leak
multipartmux memory leak
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.6
Other All
: Normal normal
: 0.10.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-02-05 16:56 UTC by orjan
Modified: 2008-02-05 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description orjan 2008-02-05 16:56:37 UTC
Please describe the problem:
In gst_multipart_mux_collected, caps are allocated but not unreffed after setting them on the pad (using gst_pad_set_caps), which introduces a memory leak of the caps.

Steps to reproduce:
Custom code, haven't been able to repeat with valgrind + gst-launch.

Actual results:
=14985== 191 (32 direct, 159 indirect) bytes in 1 blocks are definitely lost in loss record 3,795 of 3,920
==14985==    at 0x401C38B: malloc (vg_replace_malloc.c:149)
==14985==    by 0x4375915: g_malloc (gmem.c:131)
==14985==    by 0x438A752: g_slice_alloc (gslice.c:824)
==14985==    by 0x41482A1: gst_caps_new_empty (gstcaps.c:142)
==14985==    by 0x4148470: gst_caps_new_simple (gstcaps.c:194)
==14985==    by 0x5CEA7D5: gst_multipart_mux_collected (multipartmux.c:485)
==14985==    by 0x4069C3B: gst_collect_pads_check_collected (gstcollectpads.c:967)
==14985==    by 0x406B47B: gst_collect_pads_chain (gstcollectpads.c:1176)
==14985==    by 0x41AA0DB: gst_pad_chain_unchecked (gstpad.c:3518)
==14985==    by 0x41AB26D: gst_pad_push (gstpad.c:3686)
==14985==    by 0x405414B: gst_base_src_loop (gstbasesrc.c:2111)
==14985==    by 0x41EBB1E: gst_task_func (gsttask.c:192)
==14985==    by 0x4393306: g_thread_pool_thread_proxy (gthreadpool.c:265)
==14985==    by 0x439177E: g_thread_create_proxy (gthread.c:635)
==14985==    by 0x4402C50: pthread_start_thread (manager.c:310)
==14985==    by 0x4509419: clone (clone.S:119)


Expected results:
No leak.

Does this happen every time?
Yes

Other information:
Patch suggestion:

-    if (!gst_pad_set_caps (mux->srcpad, newcaps))
+    if (!gst_pad_set_caps (mux->srcpad, newcaps)) {
+      gst_caps_unref (newcaps);
       goto nego_error;
+    }
 
+    gst_caps_unref (newcaps);
     mux->negotiated = TRUE;
   }
Comment 1 Wim Taymans 2008-02-05 17:59:23 UTC
        Patch by: orjan <orjanf at axis dot com>

        * gst/multipart/multipartmux.c: (gst_multipart_mux_collected):
        Fix caps memory leak. Fixes #514573.