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 746887 - mpeg2dec: fix a couple of leaks
mpeg2dec: fix a couple of leaks
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-ugly
unspecified
Other Linux
: Normal normal
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-27 13:39 UTC by Guillaume Desmottes
Modified: 2015-03-30 20:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mpeg2dec: fix config leak (1000 bytes, patch)
2015-03-27 13:43 UTC, Guillaume Desmottes
none Details | Review
mpeg2dec: fix buffer leak in crop_buffer() (958 bytes, patch)
2015-03-27 13:43 UTC, Guillaume Desmottes
none Details | Review
mpeg2dec: fix buffer leak in crop_buffer() (1.14 KB, patch)
2015-03-30 08:43 UTC, Guillaume Desmottes
committed Details | Review

Description Guillaume Desmottes 2015-03-27 13:39:36 UTC
.
Comment 1 Guillaume Desmottes 2015-03-27 13:43:49 UTC
Created attachment 300447 [details] [review]
mpeg2dec: fix config leak

gst_buffer_pool_get_config() returns an owned GstStructure so there is no need
to copy it when passing the reference to down_config.
Comment 2 Guillaume Desmottes 2015-03-27 13:43:54 UTC
Created attachment 300448 [details] [review]
mpeg2dec: fix buffer leak in crop_buffer()

gst_buffer_pool_acquire_buffer() gives us a new owned buffer while
gst_buffer_replace() reffed it as well so we are one reference extra.
Comment 3 Nicolas Dufresne (ndufresne) 2015-03-27 13:45:33 UTC
Review of attachment 300447 [details] [review]:

Luis fixed that already.

commit 31bf54a076d7ee2a938259b8c4e9358e024a12e6
Author: Luis de Bethencourt <luis.bg@samsung.com>
Date:   Tue Mar 24 12:50:43 2015 +0000

    mpeg2dec: fix memory leak
    
    CID #1291630

diff --git a/ext/mpeg2dec/gstmpeg2dec.c b/ext/mpeg2dec/gstmpeg2dec.c
index 4a6a6e4..3ba2880 100644
--- a/ext/mpeg2dec/gstmpeg2dec.c
+++ b/ext/mpeg2dec/gstmpeg2dec.c
@@ -337,7 +337,7 @@ gst_mpeg2dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
     if (!has_videometa) {
       dec->downstream_pool = pool;
       pool = NULL;
-      down_config = gst_structure_copy (config);
+      down_config = config;
       config = NULL;
       min = 2;
       max = 0;
Comment 4 Nicolas Dufresne (ndufresne) 2015-03-27 13:49:20 UTC
Review of attachment 300448 [details] [review]:

::: ext/mpeg2dec/gstmpeg2dec.c
@@ +512,2 @@
   gst_buffer_replace (&in_frame->output_buffer, buffer);
+  gst_buffer_unref (buffer);

That wasting a ref/unref. Just do the if (blabla) unref, blabla = buffer dance ?
Comment 5 Guillaume Desmottes 2015-03-30 08:43:09 UTC
Created attachment 300566 [details] [review]
mpeg2dec: fix buffer leak in crop_buffer()

gst_buffer_pool_acquire_buffer() gives us a new owned buffer while
gst_buffer_replace() reffed it as well so we were one reference extra.
Comment 6 Nicolas Dufresne (ndufresne) 2015-03-30 20:19:45 UTC
Merged removing the right end comment.

Attachment 300566 [details] pushed as ca5fd56 - mpeg2dec: fix buffer leak in crop_buffer()