va: gst_va_create_raw_caps_from_config() may return NULL.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 16 Aug 2022 12:45:46 +0000 (14:45 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 17 Aug 2022 18:34:10 +0000 (18:34 +0000)
This patch verifies if the function returns NULL in the caller.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2899>

subprojects/gst-plugins-bad/sys/va/gstvadecoder.c
subprojects/gst-plugins-bad/sys/va/gstvaencoder.c

index 8948dd3..2917759 100644 (file)
@@ -415,6 +415,10 @@ gst_va_decoder_get_srcpad_caps (GstVaDecoder * self)
   if (gst_va_decoder_is_open (self)) {
     srcpad_caps = gst_va_create_raw_caps_from_config (self->display,
         self->config);
+    if (!srcpad_caps) {
+      GST_WARNING_OBJECT (self, "Invalid configuration caps");
+      return NULL;
+    }
     gst_caps_replace (&self->srcpad_caps, srcpad_caps);
     gst_caps_unref (srcpad_caps);
 
index 19d96c1..e5b7afe 100644 (file)
@@ -898,6 +898,10 @@ gst_va_encoder_get_sinkpad_caps (GstVaEncoder * self)
   if (gst_va_encoder_is_open (self)) {
     sinkpad_caps = gst_va_create_raw_caps_from_config (self->display,
         self->config);
+    if (!sinkpad_caps) {
+      GST_WARNING_OBJECT (self, "Invalid configuration caps");
+      return NULL;
+    }
     gst_caps_replace (&self->sinkpad_caps, sinkpad_caps);
     gst_caps_unref (sinkpad_caps);