
JNI_COMMIT doesn't actually free the buffer. From JNI docs: 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 Also introduces helper methods to help avoid this problem in the future. Bug: webrtc:10132 Change-Id: I769df286d3bd186fdf39ee2363e9002f36454509 Reviewed-on: https://webrtc-review.googlesource.com/c/120600 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26529}