8207753: Handle to process snapshot is leaked if Process32First() fails

Reviewed-by: rriggs
This commit is contained in:
Ivan Gerasimov 2018-07-19 13:41:26 -07:00
parent 5226a6a2bb
commit 121c59eb6d

View file

@ -198,7 +198,7 @@ Java_java_lang_ProcessHandleImpl_parent0(JNIEnv *env,
} else {
JNU_ThrowByName(env,
"java/lang/RuntimeException", "snapshot not available");
return -1;
ppid = (DWORD)-1;
}
CloseHandle(hProcessSnap); // Ignore return code
return (jlong)ppid;
@ -315,7 +315,7 @@ Java_java_lang_ProcessHandleImpl_getProcessPids0(JNIEnv *env,
} else {
JNU_ThrowByName(env,
"java/lang/RuntimeException", "snapshot not available");
return 0;
count = 0;
}
CloseHandle(hProcessSnap);
// If more pids than array had size for; count will be greater than array size