diff --git a/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc b/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc index fada50ca76e2..d22e0459cdbc 100644 --- a/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc +++ b/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc @@ -178,6 +178,10 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCall( int ret = TVMFuncCall(reinterpret_cast(jhandle), &argValues[0], &argTypes[0], numArgs, &retVal, &retTypeCode); + if (ret != 0) { + return ret; + } + for (auto iter = pushedStrs.cbegin(); iter != pushedStrs.cend(); iter++) { env->ReleaseStringUTFChars(iter->first, iter->second); env->DeleteGlobalRef(iter->first);