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 777533 - tsdemux: memory leak in create_pad_for_stream / gst_static_pad_template_get
tsdemux: memory leak in create_pad_for_stream / gst_static_pad_template_get
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Normal normal
: 1.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-20 12:21 UTC by Hanno Böck
Modified: 2017-01-25 12:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tsdemux: Don't leak pad name and template for Opus (1.10 KB, patch)
2017-01-20 12:34 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Hanno Böck 2017-01-20 12:21:22 UTC
file:
https://samples.mplayerhq.hu/opus/opus.ts

Note: you get much more meaningful stack traces with ASAN_OPTIONS="fast_unwind_on_malloc=0" and G_SLICE=always-malloc.

asan trace:
==3448==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 144 byte(s) in 1 object(s) allocated from:
    #0 0x4cbbb8 in malloc (/usr/bin/gst-discoverer-1.0+0x4cbbb8)
    #1 0x7f1581fcd768 in g_malloc /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gmem.c:94
    #2 0x7f1581fe54d2 in g_slice_alloc /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gslice.c:1025
    #3 0x7f1581fe5afd in g_slice_alloc0 /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gslice.c:1051
    #4 0x7f15822c3743 in g_type_create_instance /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gtype.c:1848
    #5 0x7f15822a5daa in g_object_new_internal /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1783
    #6 0x7f15822a7bad in g_object_new_valist /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:2042
    #7 0x7f15822a7e33 in g_object_new /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1626
    #8 0x7f1582d4628a in gst_static_pad_template_get /f/gstreamer/gstreamer/gst/gstpadtemplate.c:300:9
    #9 0x7f1575afe5e7 in create_pad_for_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1369:28
    #10 0x7f1575afe5e7 in gst_ts_demux_stream_added /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1656
    #11 0x7f1575aebfb8 in mpegts_base_program_add_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:564:9
    #12 0x7f1575ae8cf0 in mpegts_base_activate_program /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:920:5
    #13 0x7f1575ae8cf0 in mpegts_base_apply_pmt /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1125
    #14 0x7f1575ae8cf0 in mpegts_base_handle_psi /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1164
    #15 0x7f1575ae3a4a in mpegts_base_chain /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1423:9
    #16 0x7f1575ae0367 in mpegts_base_loop /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1591:13
    #17 0x7f1582df2973 in gst_task_func /f/gstreamer/gstreamer/gst/gsttask.c:334:5
    #18 0x7f1581fefb2d in g_thread_pool_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthreadpool.c:307
    #19 0x7f1581fef154 in g_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthread.c:784
    #20 0x7f1581a6d453 in start_thread (/lib64/libpthread.so.0+0x7453)
    #21 0x7f158159d5dc in clone (/lib64/libc.so.6+0xe75dc)

Direct leak of 11 byte(s) in 1 object(s) allocated from:
    #0 0x4cbbb8 in malloc (/usr/bin/gst-discoverer-1.0+0x4cbbb8)
    #1 0x7f15815ad697 in __vasprintf_chk (/lib64/libc.so.6+0xf7697)
    #2 0x7f158200b608 in vasprintf /usr/include/bits/stdio2.h:210
    #3 0x7f158200b608 in g_vasprintf /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gprintf.c:316
    #4 0x7f1581fe717f in g_strdup_vprintf /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gstrfuncs.c:514
    #5 0x7f1581fe721b in g_strdup_printf /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gstrfuncs.c:540
    #6 0x7f1575afe61b in create_pad_for_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1370:24
    #7 0x7f1575afe61b in gst_ts_demux_stream_added /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1656
    #8 0x7f1575aebfb8 in mpegts_base_program_add_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:564:9
    #9 0x7f1575ae8cf0 in mpegts_base_activate_program /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:920:5
    #10 0x7f1575ae8cf0 in mpegts_base_apply_pmt /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1125
    #11 0x7f1575ae8cf0 in mpegts_base_handle_psi /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1164
    #12 0x7f1575ae3a4a in mpegts_base_chain /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1423:9
    #13 0x7f1575ae0367 in mpegts_base_loop /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1591:13
    #14 0x7f1582df2973 in gst_task_func /f/gstreamer/gstreamer/gst/gsttask.c:334:5
    #15 0x7f1581fefb2d in g_thread_pool_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthreadpool.c:307
    #16 0x7f1581fef154 in g_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthread.c:784
    #17 0x7f1581a6d453 in start_thread (/lib64/libpthread.so.0+0x7453)
    #18 0x7f158159d5dc in clone (/lib64/libc.so.6+0xe75dc)

Indirect leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x4cbbb8 in malloc (/usr/bin/gst-discoverer-1.0+0x4cbbb8)
    #1 0x7f1581fcd768 in g_malloc /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gmem.c:94
    #2 0x7f1581fe701e in g_strdup /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gstrfuncs.c:363
    #3 0x7f1582c030b8 in gst_object_set_name /f/gstreamer/gstreamer/gst/gstobject.c:614:20
    #4 0x7f1582c0a3da in gst_object_set_property /f/gstreamer/gstreamer/gst/gstobject.c:916:7
    #5 0x7f15822a6122 in object_set_property /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1423
    #6 0x7f15822a6122 in g_object_new_internal /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1817
    #7 0x7f15822a7bad in g_object_new_valist /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:2042
    #8 0x7f15822a7e33 in g_object_new /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1626
    #9 0x7f1582d4628a in gst_static_pad_template_get /f/gstreamer/gstreamer/gst/gstpadtemplate.c:300:9
    #10 0x7f1575afe5e7 in create_pad_for_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1369:28
    #11 0x7f1575afe5e7 in gst_ts_demux_stream_added /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1656
    #12 0x7f1575aebfb8 in mpegts_base_program_add_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:564:9
    #13 0x7f1575ae8cf0 in mpegts_base_activate_program /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:920:5
    #14 0x7f1575ae8cf0 in mpegts_base_apply_pmt /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1125
    #15 0x7f1575ae8cf0 in mpegts_base_handle_psi /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1164
    #16 0x7f1575ae3a4a in mpegts_base_chain /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1423:9
    #17 0x7f1575ae0367 in mpegts_base_loop /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1591:13
    #18 0x7f1582df2973 in gst_task_func /f/gstreamer/gstreamer/gst/gsttask.c:334:5
    #19 0x7f1581fefb2d in g_thread_pool_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthreadpool.c:307
    #20 0x7f1581fef154 in g_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthread.c:784
    #21 0x7f1581a6d453 in start_thread (/lib64/libpthread.so.0+0x7453)
    #22 0x7f158159d5dc in clone (/lib64/libc.so.6+0xe75dc)

Indirect leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x4cbbb8 in malloc (/usr/bin/gst-discoverer-1.0+0x4cbbb8)
    #1 0x7f1581fcd768 in g_malloc /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gmem.c:94
    #2 0x7f1581fe701e in g_strdup /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gstrfuncs.c:363
    #3 0x7f1582d474a0 in gst_pad_template_set_property /f/gstreamer/gstreamer/gst/gstpadtemplate.c:406:49
    #4 0x7f15822a6122 in object_set_property /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1423
    #5 0x7f15822a6122 in g_object_new_internal /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1817
    #6 0x7f15822a7bad in g_object_new_valist /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:2042
    #7 0x7f15822a7e33 in g_object_new /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/gobject/gobject.c:1626
    #8 0x7f1582d4628a in gst_static_pad_template_get /f/gstreamer/gstreamer/gst/gstpadtemplate.c:300:9
    #9 0x7f1575afe5e7 in create_pad_for_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1369:28
    #10 0x7f1575afe5e7 in gst_ts_demux_stream_added /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/tsdemux.c:1656
    #11 0x7f1575aebfb8 in mpegts_base_program_add_stream /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:564:9
    #12 0x7f1575ae8cf0 in mpegts_base_activate_program /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:920:5
    #13 0x7f1575ae8cf0 in mpegts_base_apply_pmt /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1125
    #14 0x7f1575ae8cf0 in mpegts_base_handle_psi /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1164
    #15 0x7f1575ae3a4a in mpegts_base_chain /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1423:9
    #16 0x7f1575ae0367 in mpegts_base_loop /f/gstreamer/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c:1591:13
    #17 0x7f1582df2973 in gst_task_func /f/gstreamer/gstreamer/gst/gsttask.c:334:5
    #18 0x7f1581fefb2d in g_thread_pool_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthreadpool.c:307
    #19 0x7f1581fef154 in g_thread_proxy /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gthread.c:784
    #20 0x7f1581a6d453 in start_thread (/lib64/libpthread.so.0+0x7453)
    #21 0x7f158159d5dc in clone (/lib64/libc.so.6+0xe75dc)

SUMMARY: AddressSanitizer: 187 byte(s) leaked in 4 allocation(s).
Comment 1 Sebastian Dröge (slomo) 2017-01-20 12:34:48 UTC
Created attachment 343898 [details] [review]
tsdemux: Don't leak pad name and template for Opus

It's set again (the same way) further below, overwriting the previously
allocated memory without freeing.
Comment 2 Sebastian Dröge (slomo) 2017-01-20 12:35:00 UTC
Attachment 343898 [details] pushed as 636cb4c - tsdemux: Don't leak pad name and template for Opus