[FFmpeg-devel] [PATCH v2 4/6] avutil/jni: remove unnecessary NULL checks before calling DeleteLocalRef()

Matthieu Bouron matthieu.bouron at gmail.com
Tue Feb 27 16:50:40 EET 2024


Delete{Global,Local}Ref() already handle NULL.
---
 libavcodec/ffjni.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c
index e3cf24d3e2..69d9a9faa3 100644
--- a/libavcodec/ffjni.c
+++ b/libavcodec/ffjni.c
@@ -236,17 +236,9 @@ done:
     av_free(name);
     av_free(message);
 
-    if (class_class) {
-        (*env)->DeleteLocalRef(env, class_class);
-    }
-
-    if (exception_class) {
-        (*env)->DeleteLocalRef(env, exception_class);
-    }
-
-    if (string) {
-        (*env)->DeleteLocalRef(env, string);
-    }
+    (*env)->DeleteLocalRef(env, class_class);
+    (*env)->DeleteLocalRef(env, exception_class);
+    (*env)->DeleteLocalRef(env, string);
 
     return ret;
 }
-- 
2.44.0



More information about the ffmpeg-devel mailing list