GNOME Bugzilla – Bug 775071
memory leak in usage of gst_pad_get_current_caps() API
Last modified: 2016-12-05 09:15:13 UTC
Created attachment 340738 [details] [review] memory leak in usage of gst_pad_get_current_caps() In File: gst-plugins-good-1.10.1/gst/rtp/gstrtph264depay.c Function: gst_rtp_h264_set_src_caps() memory is allocated by old_caps at line:401 is not freed before the function returns. In file: gst-plugins-good-1.10.1/gst/rtp/gstrtpsbcdepay.c Function: gst_rtp_sbc_depay_setcaps() memory is allocated by oldcaps at line:177 is not freed before the function returns. Applied Fix: Added gst_caps_unref() to free the allocated memory.
Review of attachment 340738 [details] [review]: Please provide patches in "git format-patch" format with a meaningful commit message, thanks! :) ::: gst-plugins-good-1.10.1/gst/rtp/gstrtph264depay.c @@ +441,2 @@ gst_caps_unref (srccaps); + gst_caps_unref (old_caps); old_caps might be NULL here. Unref them in the if above ::: gst-plugins-good-1.10.1/gst/rtp/gstrtpsbcdepay.c @@ +183,2 @@ gst_caps_unref (outcaps); + gst_caps_unref (oldcaps); Same
Created attachment 340872 [details] [review] Fix Memory leak in gst_pad_get_current_caps() API usage Fix Memory leak in gst_pad_get_current_caps() API usage. This patch is in "git format-patch".
Review of attachment 340872 [details] [review]: Please include the URL to the bug report as the last line of the commit message. Also still the same problems with the patch as before: ::: gst/rtp/gstrtph264depay.c @@ +441,2 @@ gst_caps_unref (srccaps); + gst_caps_unref (old_caps); Here you are unreffing NULL caps. Move the unref into the "if (old_caps != NULL)" branch above. ::: gst/rtp/gstrtpsbcdepay.c @@ +183,2 @@ gst_caps_unref (outcaps); + gst_caps_unref (oldcaps); Same
Created attachment 341019 [details] [review] Fixed memory leak in usage of gst_pad_get_current_caps() API Now I have added the patch as per the requirement. Please review the patch with all required changes.
(In reply to Garima from comment #4) > Created attachment 341019 [details] [review] [review] > Fixed memory leak in usage of gst_pad_get_current_caps() API > > Now I have added the patch as per the requirement. > Please review the patch with all required changes. This patch has some error. I will add other patch soon.
Created attachment 341020 [details] [review] Fixed memory leak in usage of gst_pad_get_current_caps() API Final changes Please review the patch.
Review of attachment 341020 [details] [review]: ::: gst/rtp/gstrtpsbcdepay.c @@ +179,3 @@ /* Caps have changed, flush old data */ gst_adapter_clear (depay->adapter); + gst_caps_unref (oldcaps); You leak oldcaps if they are not NULL but can intersect with caps. Just put a "if (oldcaps) gst_caps_unref (oldcaps)" after the whole if
Created attachment 341128 [details] [review] The final patch created with required changes The final patch created with required changes.
commit 50e7096a86ea120ca4b5b42294a8d80433803cc6 Author: Garima Gaur <garima.g@samsung.com> Date: Thu Dec 1 15:06:06 2016 +0530 rtp: Fix some memory leaks in usage of gst_pad_get_current_caps() https://bugzilla.gnome.org/show_bug.cgi?id=775071