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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1827>
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-11-20 22:26:14 +01:00
parent 1749dc66c5
commit 1a5862dd39

View file

@ -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");