This is an automated email from the ASF dual-hosted git repository. michaelsmith pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 47389f715b8ec545b71f1fd1e2d54b3ac9bd4295 Author: Csaba Ringhofer <[email protected]> AuthorDate: Wed Apr 3 21:06:09 2024 +0200 IMPALA-12969: Release JNI array if DeserializeThriftMsg failed Before this patch ReleaseByteArrayElements was not called in case the deserialization failed (e.g. by hitting Thrift's MaxMessageSize). This could potentially cause JVM/native heap leak, depending on how the JVM handled the array allocation. Change-Id: Id2c0335b12e9289ae851d0ec050765951a8ca6c7 Reviewed-on: http://gerrit.cloudera.org:8080/21234 Reviewed-by: Michael Smith <[email protected]> Reviewed-by: Daniel Becker <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- be/src/rpc/jni-thrift-util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/be/src/rpc/jni-thrift-util.h b/be/src/rpc/jni-thrift-util.h index 3262ce77a..c2e5c0bca 100644 --- a/be/src/rpc/jni-thrift-util.h +++ b/be/src/rpc/jni-thrift-util.h @@ -58,13 +58,13 @@ Status DeserializeThriftMsg(JNIEnv* env, jbyteArray serialized_msg, T* deseriali uint32_t buf_size = env->GetArrayLength(serialized_msg); jbyte* buf = env->GetByteArrayElements(serialized_msg, &is_copy); - RETURN_IF_ERROR(DeserializeThriftMsg( - reinterpret_cast<uint8_t*>(buf), &buf_size, false, deserialized_msg)); + Status status = DeserializeThriftMsg( + reinterpret_cast<uint8_t*>(buf), &buf_size, false, deserialized_msg); /// Return buffer back. JNI_ABORT indicates to not copy contents back to java /// side. env->ReleaseByteArrayElements(serialized_msg, buf, JNI_ABORT); - return Status::OK(); + return status; } }
