[FFmpeg-devel] [PATCH 5/7] avutil/jni: remove unnecessary NULL checks before calling DeleteLocalRef()

Matthieu Bouron matthieu.bouron at gmail.com
Wed Feb 14 00:50:13 EET 2024


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

diff --git a/libavutil/jniutils.c b/libavutil/jniutils.c
index 89623af3f8..beedf24c0d 100644
--- a/libavutil/jniutils.c
+++ b/libavutil/jniutils.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.43.1



More information about the ffmpeg-devel mailing list