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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 21a8c626b13 [fix](jni-connector) avoid core dump if init connector 
failed (#34007)
21a8c626b13 is described below

commit 21a8c626b1324a412a212fd978ac70384221ecf7
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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/exec/jni_connector.cpp 
b/be/src/vec/exec/jni_connector.cpp
index 9d0612763c0..4b8eb20f227 100644
--- a/be/src/vec/exec/jni_connector.cpp
+++ b/be/src/vec/exec/jni_connector.cpp
@@ -174,7 +174,10 @@ Status JniConnector::close() {
             env->CallVoidMethod(_jni_scanner_obj, _jni_scanner_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