From f3a37fa82e68742d5571d07b1abbd8a6ea12aacb Mon Sep 17 00:00:00 2001 From: hev Date: Sun, 18 Aug 2024 12:00:42 +0800 Subject: [PATCH] HevJNI: Fix missing mutex unlock. --- src/hev-jni.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hev-jni.c b/src/hev-jni.c index d1b6e5a9d..1a6cc7352 100644 --- a/src/hev-jni.c +++ b/src/hev-jni.c @@ -102,7 +102,7 @@ native_start_service (JNIEnv *env, jobject thiz, jstring config_path) pthread_mutex_lock (&mutex); if (work_thread) - return; + goto exit; tdata = malloc (sizeof (ThreadData)); @@ -111,6 +111,7 @@ native_start_service (JNIEnv *env, jobject thiz, jstring config_path) (*env)->ReleaseStringUTFChars (env, config_path, (const char *)bytes); pthread_create (&work_thread, NULL, thread_handler, tdata); +exit: pthread_mutex_unlock (&mutex); } @@ -119,11 +120,12 @@ native_stop_service (JNIEnv *env, jobject thiz) { pthread_mutex_lock (&mutex); if (!work_thread) - return; + goto exit; hev_socks5_server_quit (); pthread_join (work_thread, NULL); work_thread = 0; +exit: pthread_mutex_unlock (&mutex); }