[FFmpeg-devel,2/4] avcodec/mediacodec_wrapper: fix a local reference leak in ff_AMediaCodec_getName()

Submitted by Matthieu Bouron on July 4, 2019, 1:43 p.m.

Details

Message ID 20190704134348.6071-2-matthieu.bouron@gmail.com
State Accepted
Commit 9cb8875c165e6377a3eebdce9743c5579f131248
Headers show

Commit Message

Matthieu Bouron July 4, 2019, 1:43 p.m.
---
 libavcodec/mediacodec_wrapper.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index a024e3bdb1..e2df07cb41 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -1337,6 +1337,10 @@  char *ff_AMediaCodec_getName(FFAMediaCodec *codec)
     ret = ff_jni_jstring_to_utf_chars(env, name, codec);
 
 fail:
+    if (name) {
+        (*env)->DeleteLocalRef(env, name);
+    }
+
     return ret;
 }