[FFmpeg-devel] [PATCH v4 01/14] avcodec/videotoolbox: use early return in videotoolbox_default_free

Aman Gupta ffmpeg at tmm1.net
Fri Nov 10 23:40:46 EET 2017


From: Aman Gupta <aman at tmm1.net>

Cosmetic change only.
---
 libavcodec/videotoolbox.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index ecb2502c1f..f5a282f72c 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -849,15 +849,15 @@ static int videotoolbox_default_init(AVCodecContext *avctx)
 static void videotoolbox_default_free(AVCodecContext *avctx)
 {
     AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
+    if (!videotoolbox)
+        return;
 
-    if (videotoolbox) {
-        if (videotoolbox->cm_fmt_desc)
-            CFRelease(videotoolbox->cm_fmt_desc);
+    if (videotoolbox->cm_fmt_desc)
+        CFRelease(videotoolbox->cm_fmt_desc);
 
-        if (videotoolbox->session) {
-            VTDecompressionSessionInvalidate(videotoolbox->session);
-            CFRelease(videotoolbox->session);
-        }
+    if (videotoolbox->session) {
+        VTDecompressionSessionInvalidate(videotoolbox->session);
+        CFRelease(videotoolbox->session);
     }
 }
 
-- 
2.14.2



More information about the ffmpeg-devel mailing list