mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8207753: Handle to process snapshot is leaked if Process32First() fails
Reviewed-by: rriggs
This commit is contained in:
parent
5226a6a2bb
commit
121c59eb6d
1 changed files with 4 additions and 4 deletions
|
@ -198,7 +198,7 @@ Java_java_lang_ProcessHandleImpl_parent0(JNIEnv *env,
|
||||||
} else {
|
} else {
|
||||||
JNU_ThrowByName(env,
|
JNU_ThrowByName(env,
|
||||||
"java/lang/RuntimeException", "snapshot not available");
|
"java/lang/RuntimeException", "snapshot not available");
|
||||||
return -1;
|
ppid = (DWORD)-1;
|
||||||
}
|
}
|
||||||
CloseHandle(hProcessSnap); // Ignore return code
|
CloseHandle(hProcessSnap); // Ignore return code
|
||||||
return (jlong)ppid;
|
return (jlong)ppid;
|
||||||
|
@ -267,13 +267,13 @@ Java_java_lang_ProcessHandleImpl_getProcessPids0(JNIEnv *env,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (jparentArray != NULL) {
|
if (jparentArray != NULL) {
|
||||||
ppids = (*env)->GetLongArrayElements(env, jparentArray, NULL);
|
ppids = (*env)->GetLongArrayElements(env, jparentArray, NULL);
|
||||||
if (ppids == NULL) {
|
if (ppids == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (jstimesArray != NULL) {
|
if (jstimesArray != NULL) {
|
||||||
stimes = (*env)->GetLongArrayElements(env, jstimesArray, NULL);
|
stimes = (*env)->GetLongArrayElements(env, jstimesArray, NULL);
|
||||||
if (stimes == NULL) {
|
if (stimes == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ Java_java_lang_ProcessHandleImpl_getProcessPids0(JNIEnv *env,
|
||||||
} else {
|
} else {
|
||||||
JNU_ThrowByName(env,
|
JNU_ThrowByName(env,
|
||||||
"java/lang/RuntimeException", "snapshot not available");
|
"java/lang/RuntimeException", "snapshot not available");
|
||||||
return 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
CloseHandle(hProcessSnap);
|
CloseHandle(hProcessSnap);
|
||||||
// If more pids than array had size for; count will be greater than array size
|
// If more pids than array had size for; count will be greater than array size
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue