--- a/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c Tue Dec 18 16:50:35 2018 +0000
+++ b/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c Wed Dec 19 10:30:43 2018 +0100
@@ -457,12 +457,11 @@
if (pCode == NULL) {
JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
VirtualFreeEx(hProcess, pData, 0, MEM_RELEASE);
+ (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
return;
}
WriteProcessMemory( hProcess, (LPVOID)pCode, (LPCVOID)stubCode, (SIZE_T)stubLen, NULL );
- if (isCopy) {
- (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
- }
+ (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
/*
* Create thread in target process to execute code