GNOME Bugzilla – Bug 788465
baseparse: memory leak in error code path
Last modified: 2018-01-19 18:18:31 UTC
Hi, I found memory leak, in gstbaseparse.c file when there is no caps created. line 2402: /* should have caps by now */ if (!gst_pad_has_current_caps (parse->srcpad)) goto no_caps; Solution:- /* should have caps by now */ if (!gst_pad_has_current_caps (parse->srcpad)) { gst_buffer_unref (buffer); goto no_caps; } Please review . Regards, Renu
Thanks for the bug report. Please could you make a patch in git format-patch format? https://gstreamer.freedesktop.org/documentation/contribute/index.html#how-to-submit-patches
Created attachment 360946 [details] [review] Please find the attached Patch. Please find the attached Patch. Please review and verify.
Comment on attachment 360946 [details] [review] Please find the attached Patch. Not clear to me that this is correct. The docs say that this function takes ownership of the frame's buffer, but not the frame. However, we only take ownership of the frame's buffer later in the code as far as I can see. If we unref the buffer here, we need to clear it from the frame I think, otherwise we leave a dangling pointer around. But to me it seems like it should be fine to leave the buffer in the frame in the error case, and then it should be unreffed when the frame gets freed. It's not clear to me that this needs fixing at all.
Closing. Please feel free to re-open if you can explain in more details or have a test case that demonstrates a leak. Thanks!