[FFmpeg-devel] [PATCH 1/2] examples/vaapi_encode: Remove redundancy check when free context.

Jun Zhao mypopydev at gmail.com
Thu Jan 11 09:07:18 EET 2018


-------------- next part --------------
From ef424745ce8d425859e9ca16dd9aca72297ed90a Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao at intel.com>
Date: Thu, 11 Jan 2018 13:21:58 +0800
Subject: [PATCH 1/2] examples/vaapi_encode: Remove redundancy check when free
 context.

avcodec_free_context have handle NULL pointer case, so caller doesn't
need to check the NULL before call this function.

Signe-off-by: Jun Zhao <jun.zhao at intel.com>
---
 doc/examples/vaapi_encode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
index f66a4a7c48..6425b1c98c 100644
--- a/doc/examples/vaapi_encode.c
+++ b/doc/examples/vaapi_encode.c
@@ -217,8 +217,7 @@ close:
         fclose(fout);
     av_frame_free(&sw_frame);
     av_frame_free(&hw_frame);
-    if (avctx)
-        avcodec_free_context(&avctx);
+    avcodec_free_context(&avctx);
     av_buffer_unref(&hw_device_ctx);
 
     return err;
-- 
2.14.1



More information about the ffmpeg-devel mailing list