From 5ad67ea666c96ecd01212caa39ad0b1432e6d726 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Sun, 22 Dec 2019 15:22:57 +0800 Subject: 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. --- gst-libs/gst/vaapi/gstvaapiencoder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index 2d29d04d..3f0e9a7c 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder.c @@ -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; -- cgit v1.2.3