libs: encoder: Add NULL pointer check for context when finalize.

Context may be NULL if pipeline fail in early stage, and the
ensure_context will not be called. Need to add a pointer protection
for it.
This commit is contained in:
He Junyan 2019-12-22 15:22:57 +08:00
parent 18d1c75d1a
commit 5ad67ea666

View file

@ -1345,7 +1345,8 @@ gst_vaapi_encoder_finalize (GObject * object)
{
GstVaapiEncoder *encoder = GST_VAAPI_ENCODER (object);
gst_vaapi_context_unref (encoder->context);
if (encoder->context)
gst_vaapi_context_unref (encoder->context);
encoder->context = NULL;
gst_vaapi_display_replace (&encoder->display, NULL);
encoder->va_display = NULL;