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
Loading
Please sign in to comment