GNOME Bugzilla – Bug 707282
Memory leak in h264 codecparser
Last modified: 2014-06-28 08:45:03 UTC
The gst_h264_parse_pps() method is allocating memory dynamically for slice_group_id field of pps which is not freeing. In order to support dynamic allocation we have to change the codecparser implementation. This is exactly what we did in https://bugzilla.gnome.org/show_bug.cgi?id=685215 to support mvc by providing dynamic allocation support in nal_parsing APIs by implementing copy() and free() methods for sps. Suggestions?
Yes, exactly what you proposed :)
(In reply to comment #1) > Yes, exactly what you proposed :) Okay. This patch would be copy-paste from https://bugzilla.gnome.org/show_bug.cgi?id=685215 . So I prefer Gwenole to do that since he is the initial author. What do you think? :)
Gwenole?
h264 is the only multithreaded encoder (as far as I know in Pitivi land), would be nice to have it usable. Gwenole, interested in fixing this?
Sorry, I had the impression that the problem is with the encoder, but it's with the decoder.
Ping?
OK, I will create an internal gst_h264_pps_copy() function, and expose an external gst_h264_pps_clear().
Created attachment 279365 [details] [review] codecparsers: h264: fix memory leak in GstH264PPS. The patch formerly promised to address this issue. :)
Review of attachment 279365 [details] [review]: Please push, but before fix these small things :) ::: gst-libs/gst/codecparsers/gsth264parser.c @@ +227,3 @@ + */ +static gboolean +gst_h264_pps_copy (GstH264PPS * dst_pps, const GstH264PPS * src_pps) The src_pps should be const probably @@ +239,3 @@ + dst_pps->slice_group_id = g_memdup (src_pps->slice_group_id, + src_pps->pic_size_in_map_units_minus1 + 1); + if (!dst_pps->slice_group_id) g_memdup() will abort() if it fails to allocate memory
This is fixed now, right? commit 9bd186a960132b2141e2baffebc458501133d582 Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com> Date: Fri Jun 27 10:53:20 2014 +0200 codecparsers: h264: fix memory leak in GstH264PPS. The gst_h264_parse_pps() function dynamically allocates the slice group ids map array, so that needs to be cleared before parsing a new PPS NAL unit again, or when it is no longer needed. Likewise, a clean copy to the internal NAL parser state needs to be performed so that to avoid a double-free corruption. https://bugzilla.gnome.org/show_bug.cgi?id=707282 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>