[FFmpeg-devel] [PATCH 2/2] lavc/mediacodec_wrapper: fix potential jni global reference leak

Matthieu Bouron matthieu.bouron at gmail.com
Thu Dec 14 12:09:14 EET 2017


---
 libavcodec/mediacodec_wrapper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 4660e895ca..f54e06b0ef 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1194,6 +1194,9 @@ fail:
     }                                                                                       \
                                                                                             \
     if (ret < 0) {                                                                          \
+        if (codec->object) {                                                                \
+            (*env)->DeleteGlobalRef(env, codec->object);                                    \
+        }                                                                                   \
         ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec);      \
         av_freep(&codec);                                                                   \
     }                                                                                       \
-- 
2.15.1



More information about the ffmpeg-devel mailing list