[libbluray-devel] bdj: fix bdj_close() segfaults when jvm init fails

hpi1 git at videolan.org
Thu Dec 20 10:57:31 CET 2012


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Nov 16 09:17:03 2012 +0200| [ee81c191eccf94ed62c784f64a5c1329bce73c17] | committer: hpi1

bdj: fix bdj_close() segfaults when jvm init fails

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

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

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index ac44aaf..1401d22 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -230,6 +230,7 @@ void bdj_close(BDJAVA *bdjava)
         return;
     }
 
+    if (bdjava->jvm) {
     if ((*bdjava->jvm)->GetEnv(bdjava->jvm, (void**)&env, JNI_VERSION_1_6) != JNI_OK) {
         (*bdjava->jvm)->AttachCurrentThread(bdjava->jvm, (void**)&env, NULL);
         attach = 1;
@@ -246,8 +247,11 @@ void bdj_close(BDJAVA *bdjava)
     }
 
     (*bdjava->jvm)->DestroyJavaVM(bdjava->jvm);
+    }
 
+    if (bdjava->h_libjvm) {
     dl_dlclose(bdjava->h_libjvm);
+    }
 
     X_FREE(bdjava);
 }



More information about the libbluray-devel mailing list