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; }