From 1a5862dd39c1805dbf0afe465077a79cd7c35a00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 20 Nov 2020 22:26:14 +0100 Subject: [PATCH] codecs: h264decoder: fix memory leak gst_h264_dbp_get_picture_all() returns a full transfer of the GArray, which needs be unrefed. But it is not unrefed in gst_h264_decoder_find_first_field_picture() leaking it. Part-of: --- gst-libs/gst/codecs/gsth264decoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/codecs/gsth264decoder.c b/gst-libs/gst/codecs/gsth264decoder.c index a039c06..e295e5d 100644 --- a/gst-libs/gst/codecs/gsth264decoder.c +++ b/gst-libs/gst/codecs/gsth264decoder.c @@ -902,6 +902,7 @@ gst_h264_decoder_find_first_field_picture (GstH264Decoder * self, pictures = gst_h264_dpb_get_pictures_all (priv->dpb); prev_picture = g_array_index (pictures, GstH264Picture *, pictures->len - 1); + g_array_unref (pictures); /* prev_picture should be hold */ /* This is not a field picture */ if (!slice_hdr->field_pic_flag) { @@ -934,7 +935,7 @@ gst_h264_decoder_find_first_field_picture (GstH264Decoder * self, return FALSE; } - *first_field = prev_picture; + *first_field = gst_h264_picture_ref (prev_picture); return TRUE; } @@ -983,6 +984,7 @@ gst_h264_decoder_parse_slice (GstH264Decoder * self, GstH264NalUnit * nalu) if (first_field) { picture = gst_h264_decoder_new_field_picture (self, first_field); + gst_h264_picture_unref (first_field); if (!picture) { GST_ERROR_OBJECT (self, "Couldn't duplicate the first field picture"); -- 2.7.4