summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2020-03-31 12:22:31 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2020-03-31 15:03:30 +0800
commitf680a8cba12da81f7bcb97121b888e4f74b27ea4 (patch)
tree9fcd9a5ad7b4ab6090ee7200936e99635da10f50 /gst-libs
parentecbf070fa4c38c4fefeedca2224bdc7208f299a0 (diff)
libs: encoder: make sure format array is not NULL when returning TRUE
This fixed segfault when running the pipeline below with iHD driver (commit efe5e9a) on ICL gst-launch-1.0 videotestsrc ! vaapivp9enc tune=low-power ! vaapivp9dec ! \ fakesink
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c
index bc2584b9..2f97bd9b 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder.c
@@ -1481,9 +1481,13 @@ get_profile_surface_attributes (GstVaapiEncoder * encoder,
return FALSE;
ret = gst_vaapi_context_get_surface_attributes (ctxt, attribs);
- if (ret)
+ if (ret) {
attribs->formats = gst_vaapi_context_get_surface_formats (ctxt);
+ if (!attribs->formats)
+ ret = FALSE;
+ }
+
gst_vaapi_context_unref (ctxt);
return ret;
}