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 761070 - h265parse: Fix buffer memory leak
h265parse: Fix buffer memory leak
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.6.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
1.6.4
Depends on:
Blocks:
 
 
Reported: 2016-01-25 03:06 UTC by Vineeth
Modified: 2016-04-14 17:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix buffer leak (930 bytes, patch)
2016-01-25 03:07 UTC, Vineeth
committed Details | Review
fix buffer leak when sps is not present. (1.39 KB, patch)
2016-01-25 04:38 UTC, Vineeth
committed Details | Review

Description Vineeth 2016-01-25 03:06:21 UTC
While setting caps, codec_data buffer is mapped, but not being unmapped leading to memory leaks.
Comment 1 Vineeth 2016-01-25 03:07:07 UTC
Created attachment 319644 [details] [review]
fix buffer leak

Fix for the below leak

==31311== 202 bytes in 1 blocks are definitely lost in loss record 3,929 of 4,058
==31311==    at 0x402C17C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==31311==    by 0x425EBE2: g_malloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
==31311==    by 0x4275281: g_slice_alloc (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
==31311==    by 0x409DF03: _sysmem_new_block (gstallocator.c:414)
==31311==    by 0x409E5DA: gst_allocator_alloc (gstallocator.c:311)
==31311==    by 0x40AA405: gst_buffer_new_allocate (gstbuffer.c:755)
==31311==    by 0x718A63C: qtdemux_parse_tree (qtdemux.c:9151)
==31311==    by 0x718FBA8: gst_qtdemux_loop_state_header (qtdemux.c:3885)
==31311==    by 0x7193FB0: gst_qtdemux_loop (qtdemux.c:5287)
==31311==    by 0x411BC68: gst_task_func (gsttask.c:331)
==31311==    by 0x411CE0E: default_func (gsttaskpool.c:68)
==31311==    by 0x4280404: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
==31311==    by 0x427F9A9: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0)
==31311==    by 0x4324F6F: start_thread (pthread_create.c:312)
==31311==    by 0x4426BED: clone (clone.S:129)
Comment 2 Vineeth 2016-01-25 04:38:14 UTC
Created attachment 319656 [details] [review]
fix buffer leak when sps is not present.

While just reviewing the code of h265parse, found another place where there is a potential leak.

When SPS is not present, there is no need to allocate buffer and map it.
So moving the check for SPS above the buffer allocation.
Comment 3 Thiago Sousa Santos 2016-01-25 13:18:43 UTC
commit e389211aa54f2b1da9df9dbe80f8624ba5e045db
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Mon Jan 25 13:33:09 2016 +0900

    h265parse: Fix buffer leak when sps is not present
    
    When sps data is NULL, the buffer allocated and mapped is not being freed.
    In this scenario there is no need to allocate the buffer as we are supposed to return NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761070

commit 6a35a4018e4274ce1965054161e92291d19f6291
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Mon Jan 25 12:05:12 2016 +0900

    h265parse: Fix buffer memory leak.
    
    While setting caps, codec_data buffer is mapped, but not being unmapped
    leading to memory leaks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761070
Comment 4 Thiago Sousa Santos 2016-01-25 13:56:06 UTC
Merged to 1.6:
commit 6520a2c6866203d0e141ef7987de10cd6fc38b8f
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Mon Jan 25 13:33:09 2016 +0900

    h265parse: Fix buffer leak when sps is not present
    
    When sps data is NULL, the buffer allocated and mapped is not being freed.
    In this scenario there is no need to allocate the buffer as we are supposed to return NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761070

commit 9bc4dfd004316f6ff4d6552c9c292537e608b7a0
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Mon Jan 25 12:05:12 2016 +0900

    h265parse: Fix buffer memory leak.
    
    While setting caps, codec_data buffer is mapped, but not being unmapped
    leading to memory leaks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761070