From eda173b3b089fc6da88c8fb77b9f9bdacb83dfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 17 Jan 2020 12:54:21 +0100 Subject: [PATCH] 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. --- gst-libs/gst/vaapi/gstvaapiencoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index 771a82b7e6..edc443ab79 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;