This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 7327f04e1f678037f6b988c85cd436a196252f64
Author: Mingyu Chen <[email protected]>
AuthorDate: Tue Apr 23 16:38:00 2024 +0800

    [fix](jni-connector) avoid core dump if init connector failed (#34007)
    
    _jni_scanner_cls may be null if connector init failed.
    So need to check it before delete it.
---
 be/src/vec/exec/jni_connector.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/be/src/vec/exec/jni_connector.cpp 
b/be/src/vec/exec/jni_connector.cpp
index 1bbe5bdf49a..4a496bfb1c2 100644
--- a/be/src/vec/exec/jni_connector.cpp
+++ b/be/src/vec/exec/jni_connector.cpp
@@ -175,6 +175,10 @@ Status JniConnector::close() {
             env->DeleteGlobalRef(_jni_scanner_obj);
             env->DeleteGlobalRef(_jni_scanner_cls);
         }
+        if (_jni_scanner_cls != nullptr) {
+            // _jni_scanner_cls may be null if init connector failed
+            env->DeleteGlobalRef(_jni_scanner_cls);
+        }
         _closed = true;
         jthrowable exc = (env)->ExceptionOccurred();
         if (exc != nullptr) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to