Skip to content

Commit 8f8e9c5

Browse files
authored
Merge pull request #20168 from tajila/criu_1
(0.48) Remove potential double free of syslog
2 parents 3be5a9b + 5541cef commit 8f8e9c5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

runtime/vm/CRIUHelpers.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
18191819
if (JVMTI_ERROR_NONE != systemReturnCode) {
18201820
currentExceptionClass = vm->checkpointState.criuJVMCheckpointExceptionClass;
18211821
nlsMsgFormat = j9nls_lookup_message(J9NLS_DO_NOT_PRINT_MESSAGE_TAG | J9NLS_DO_NOT_APPEND_NEWLINE, J9NLS_JVMTI_COM_IBM_LOG_QUERY_OPT_ERROR, NULL);
1822-
j9mem_free_memory(syslogOptions);
18231822
goto wakeJavaThreadsWithExclusiveVMAccess;
18241823
}
18251824
Trc_VM_criu_checkpointJVMImpl_syslogOptions(currentThread, syslogOptions);
@@ -1864,7 +1863,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
18641863
J9NLS_DO_NOT_PRINT_MESSAGE_TAG | J9NLS_DO_NOT_APPEND_NEWLINE,
18651864
J9NLS_VM_CRIU_J9_CURRENT_TIME_NANOS_FAILURE,
18661865
NULL);
1867-
j9mem_free_memory(syslogOptions);
18681866
restoreFailure = true;
18691867
}
18701868

@@ -1880,7 +1878,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
18801878
j9port_control(J9PORT_CTLDATA_SYSLOG_OPEN, 0);
18811879
setLogOptions(vm, syslogOptions);
18821880
}
1883-
j9mem_free_memory(syslogOptions);
18841881

18851882
if (hasDumpSucceeded) {
18861883
/* Calculate restore time excluding `criu restore ...` for MXBean API. */
@@ -1892,7 +1889,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
18921889
J9NLS_DO_NOT_PRINT_MESSAGE_TAG | J9NLS_DO_NOT_APPEND_NEWLINE,
18931890
J9NLS_VM_CRIU_J9_GET_PROCESS_START_TIME_FAILURE,
18941891
NULL);
1895-
j9mem_free_memory(syslogOptions);
18961892
restoreFailure = true;
18971893
}
18981894
vm->checkpointState.processRestoreStartTimeInNanoseconds = (I_64)restoreNanoUTCTime;
@@ -2088,6 +2084,8 @@ criuCheckpointJVMImpl(JNIEnv *env,
20882084
j9mem_free_memory(directoryChars);
20892085
}
20902086

2087+
j9mem_free_memory(syslogOptions);
2088+
20912089
VM_VMHelpers::setVMState(currentThread, oldVMState);
20922090
internalExitVMToJNI(currentThread);
20932091
#endif /* defined(LINUX) */

0 commit comments

Comments
 (0)