From: Víctor Manuel Jáquez Leal Date: Fri, 17 Jan 2020 11:54:21 +0000 (+0100) Subject: libs: encoder: unref formats array if none X-Git-Tag: 1.19.3~503^2~299 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eda173b3b089fc6da88c8fb77b9f9bdacb83dfb7;p=platform%2Fupstream%2Fgstreamer.git libs: encoder: unref formats array if none The formats array is always created, in order to keep the logic and to avoid broken caps, if this formats array doesn't contain any elements, it has to be unref and the function should return NULL. --- diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index 771a82b..edc443a 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder.c @@ -1577,8 +1577,10 @@ gst_vaapi_encoder_get_surface_attributes (GstVaapiEncoder * encoder, } } - if (!attribs.formats) + if (attribs.formats->len == 0) { + g_array_unref (attribs.formats); return NULL; + } if (min_width) *min_width = attribs.min_width;