vabasedec: Fix a possible NULL pointer dereference

The format in _get_preferred_format_and_caps_features() may be NULL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6206>
This commit is contained in:
He Junyan 2024-02-23 21:54:17 +08:00 committed by GStreamer Marge Bot
parent 489f310881
commit a734f95790

View file

@ -876,10 +876,13 @@ gst_va_base_dec_get_preferred_format_and_caps_features (GstVaBaseDec * base,
* if downstream doesn't support system memory negotiation will fail later.
*/
if (is_any) {
GstVideoFormat fmt =
_caps_video_format_from_chroma (allowed_caps, base->rt_format);
features = GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY;
if (format)
*format = _caps_video_format_from_chroma (allowed_caps, base->rt_format);
if (capsfeatures && *format != GST_VIDEO_FORMAT_UNKNOWN)
*format = fmt;
if (capsfeatures && fmt != GST_VIDEO_FORMAT_UNKNOWN)
*capsfeatures = gst_caps_features_copy (features);
goto bail;
}