PG1204 opened a new pull request, #1249:
URL: https://github.com/apache/arrow-java/pull/1249

   ## What's Changed
   
   `FromSchemaByteArray()` in `dataset/src/main/cpp/jni_util.cc` acquires the 
Java byte-array elements via `GetByteArrayElements()`, but the matching 
`ReleaseByteArrayElements()` call was only reached on the success path.
   When `arrow::ipc::ReadSchema()` failed, `ARROW_ASSIGN_OR_RAISE` returned 
early and skipped the release, leaking the pinned/copied array buffer on every 
call with malformed or incompatible serialized schema bytes (e.g. via the 
public `createDataset()` method).
   
   This change releases the elements through an RAII guard (a `std::unique_ptr` 
with a custom deleter) so they are always freed on every exit path - success or 
error, and remains correct if additional early returns are
   added in the future.
   
   Closes #1205.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to