Skip to content

Commit 3100581

Browse files
authored
[GLUTEN-11473][VL] Add null check for array_ when releasing JavaRssClient (#11474)
1 parent 3628656 commit 3100581

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cpp/core/jni/JniCommon.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,12 @@ class JavaRssClient : public RssClient {
502502
return;
503503
}
504504
env->DeleteGlobalRef(javaRssShuffleWriter_);
505-
jbyte* byteArray = env->GetByteArrayElements(array_, NULL);
506-
env->ReleaseByteArrayElements(array_, byteArray, JNI_ABORT);
507-
env->DeleteGlobalRef(array_);
505+
// array_ may be nullptr when failed to allocate new byte array in pushPartitionData
506+
if (array_ != nullptr) {
507+
jbyte* byteArray = env->GetByteArrayElements(array_, NULL);
508+
env->ReleaseByteArrayElements(array_, byteArray, JNI_ABORT);
509+
env->DeleteGlobalRef(array_);
510+
}
508511
}
509512

510513
int32_t pushPartitionData(int32_t partitionId, const char* bytes, int64_t size) override {

0 commit comments

Comments
 (0)