summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2019-12-22 15:22:57 +0800
committerHe Junyan <junyan.he@hotmail.com>2019-12-22 15:22:57 +0800
commit5ad67ea666c96ecd01212caa39ad0b1432e6d726 (patch)
tree8d23c0f5ee03e31c46efea4b9c36f79941ad4ffc
parent18d1c75d1a98123549bb994113df2614655c558b (diff)
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.
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder.c3
1 files changed, 2 insertions, 1 deletions
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;