Commit fbc5460b authored by A. Unique TensorFlower's avatar A. Unique TensorFlower Committed by TensorFlower Gardener
Browse files

Fix incorrect use of JNI_COMMIT.

In the case of GetByteArrayElements returning a copy, JNI_COMMIT will not free the copy buffer. Using 0 instead fixes the issue:

Table 4-10 Primitive Array Release Modes
mode       actions
0          copy back the content and free the elems buffer
JNI_COMMIT copy back the content but do not free the elems buffer
JNI_ABORT  free the buffer without copying back the possible changes

http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp17314

In this case, the getByteArrayElements and matching release call are unnecessary - since the elements are never observed, we can just copy into it directly via the JNI APIs.

PiperOrigin-RevId: 174409824
parent d90e886f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment