From 320fc511dcb07374b780f2a5090dd072e4e6336a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 21 Oct 2013 10:50:37 -0500 Subject: [PATCH] Fix potential memory leak in RandomAccessFile#readBytes This was noticed when copy-editing writeBytes. Signed-off-by: Johannes Schindelin --- classpath/java-io.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index a332272afb..083df06133 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -889,6 +889,7 @@ Java_java_io_RandomAccessFile_readBytes(JNIEnv* e, jclass, jlong peer, DWORD bytesRead = 0; if(!ReadFile(hFile, dst + offset, length, &bytesRead, nullptr)) { + e->ReleasePrimitiveArrayCritical(buffer, dst, 0); throwNewErrno(e, "java/io/IOException"); return -1; }