8276990: Memory leak in invoker.c fillInvokeRequest() during JDI operations

Reviewed-by: sspitsyn, cjplummer
This commit is contained in:
Roman Kennke 2022-02-03 07:24:59 +00:00
parent fe547eacd7
commit 5ab22e88da

View File

@ -232,6 +232,7 @@ fillInvokeRequest(JNIEnv *env, InvokeRequest *request,
/*
* Squirrel away the method signature
*/
JDI_ASSERT_MSG(request->methodSignature == NULL, "Request methodSignature not null");
error = methodSignature(method, NULL, &request->methodSignature, NULL);
if (error != JVMTI_ERROR_NONE) {
return error;
@ -775,6 +776,10 @@ invoker_completeInvokeRequest(jthread thread)
*/
deleteGlobalArgumentRefs(env, request);
JDI_ASSERT_MSG(request->methodSignature != NULL, "methodSignature is NULL");
jvmtiDeallocate(request->methodSignature);
request->methodSignature = NULL;
/* From now on, do not access the request structure anymore
* for this request id, because once we give up the invokerLock it may
* be immediately reused by a new invoke request.