[libbluray-devel] bdj: Fix leak (Java references)

hpi1 git at videolan.org
Sun Aug 7 13:33:26 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Aug  7 13:35:53 2016 +0300| [eecd4aba5330d6bf53c7bf4a5ffd9585d1e75370] | committer: hpi1

bdj: Fix leak (Java references)

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=eecd4aba5330d6bf53c7bf4a5ffd9585d1e75370
---

 src/libbluray/bdj/bdj.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 67d9170..6edd907 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -446,6 +446,12 @@ static int _bdj_init(JNIEnv *env, struct bluray *bd, const char *disc_root, cons
                                  param_bdjava_ptr, param_disc_id, param_disc_root,
                                  param_persistent_root, param_buda_root);
 
+    (*env)->DeleteLocalRef(env, init_class);
+    (*env)->DeleteLocalRef(env, param_disc_id);
+    (*env)->DeleteLocalRef(env, param_disc_root);
+    (*env)->DeleteLocalRef(env, param_persistent_root);
+    (*env)->DeleteLocalRef(env, param_buda_root);
+
     if ((*env)->ExceptionOccurred(env)) {
         (*env)->ExceptionDescribe(env);
         BD_DEBUG(DBG_BDJ | DBG_CRIT, "Failed to initialize BD-J (uncaught exception)\n");
@@ -453,10 +459,6 @@ static int _bdj_init(JNIEnv *env, struct bluray *bd, const char *disc_root, cons
         return 0;
     }
 
-    (*env)->DeleteLocalRef(env, init_class);
-    (*env)->DeleteLocalRef(env, param_disc_id);
-    (*env)->DeleteLocalRef(env, param_disc_root);
-
     return 1;
 }
 



More information about the libbluray-devel mailing list