Commit 718b7d0b authored by Haihao Xiang's avatar Haihao Xiang Committed by Víctor Manuel Jáquez Leal
Browse files

msdk: check the created context against NULL pointer

gst_msdk_context_new_with_parent() may return NULL
parent 801189c0
......@@ -649,10 +649,17 @@ gst_msdkdec_start (GstVideoDecoder * decoder)
thiz->use_video_memory = TRUE;
if (gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_DECODER) {
GstMsdkContext *parent_context;
GstMsdkContext *parent_context, *msdk_context;
parent_context = thiz->context;
thiz->context = gst_msdk_context_new_with_parent (parent_context);
msdk_context = gst_msdk_context_new_with_parent (parent_context);
if (!msdk_context) {
GST_ERROR_OBJECT (thiz, "Context creation failed");
return FALSE;
}
thiz->context = msdk_context;
gst_msdk_context_add_shared_async_depth (thiz->context,
gst_msdk_context_get_shared_async_depth (parent_context));
......
......@@ -1371,10 +1371,17 @@ gst_msdkenc_start (GstVideoEncoder * encoder)
thiz->context);
if (gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_ENCODER) {
GstMsdkContext *parent_context;
GstMsdkContext *parent_context, *msdk_context;
parent_context = thiz->context;
thiz->context = gst_msdk_context_new_with_parent (parent_context);
msdk_context = gst_msdk_context_new_with_parent (parent_context);
if (!msdk_context) {
GST_ERROR_OBJECT (thiz, "Context creation failed");
return FALSE;
}
thiz->context = msdk_context;
gst_object_unref (parent_context);
GST_INFO_OBJECT (thiz,
......
......@@ -144,10 +144,17 @@ ensure_context (GstBaseTransform * trans)
thiz->context);
if (gst_msdk_context_get_job_type (thiz->context) & GST_MSDK_JOB_VPP) {
GstMsdkContext *parent_context;
GstMsdkContext *parent_context, *msdk_context;
parent_context = thiz->context;
thiz->context = gst_msdk_context_new_with_parent (parent_context);
msdk_context = gst_msdk_context_new_with_parent (parent_context);
if (!msdk_context) {
GST_ERROR_OBJECT (thiz, "Context creation failed");
return FALSE;
}
thiz->context = msdk_context;
gst_object_unref (parent_context);
GST_INFO_OBJECT (thiz,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment