Skip to content

Commit

Permalink
Merge pull request eclipse-openj9#20168 from tajila/criu_1
Browse files Browse the repository at this point in the history
(0.48) Remove potential double free of syslog
  • Loading branch information
pshipton authored Sep 16, 2024
2 parents 3be5a9b + 5541cef commit 8f8e9c5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions runtime/vm/CRIUHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
if (JVMTI_ERROR_NONE != systemReturnCode) {
currentExceptionClass = vm->checkpointState.criuJVMCheckpointExceptionClass;
nlsMsgFormat = j9nls_lookup_message(J9NLS_DO_NOT_PRINT_MESSAGE_TAG | J9NLS_DO_NOT_APPEND_NEWLINE, J9NLS_JVMTI_COM_IBM_LOG_QUERY_OPT_ERROR, NULL);
j9mem_free_memory(syslogOptions);
goto wakeJavaThreadsWithExclusiveVMAccess;
}
Trc_VM_criu_checkpointJVMImpl_syslogOptions(currentThread, syslogOptions);
Expand Down Expand Up @@ -1864,7 +1863,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
J9NLS_DO_NOT_PRINT_MESSAGE_TAG | J9NLS_DO_NOT_APPEND_NEWLINE,
J9NLS_VM_CRIU_J9_CURRENT_TIME_NANOS_FAILURE,
NULL);
j9mem_free_memory(syslogOptions);
restoreFailure = true;
}

Expand All @@ -1880,7 +1878,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
j9port_control(J9PORT_CTLDATA_SYSLOG_OPEN, 0);
setLogOptions(vm, syslogOptions);
}
j9mem_free_memory(syslogOptions);

if (hasDumpSucceeded) {
/* Calculate restore time excluding `criu restore ...` for MXBean API. */
Expand All @@ -1892,7 +1889,6 @@ criuCheckpointJVMImpl(JNIEnv *env,
J9NLS_DO_NOT_PRINT_MESSAGE_TAG | J9NLS_DO_NOT_APPEND_NEWLINE,
J9NLS_VM_CRIU_J9_GET_PROCESS_START_TIME_FAILURE,
NULL);
j9mem_free_memory(syslogOptions);
restoreFailure = true;
}
vm->checkpointState.processRestoreStartTimeInNanoseconds = (I_64)restoreNanoUTCTime;
Expand Down Expand Up @@ -2088,6 +2084,8 @@ criuCheckpointJVMImpl(JNIEnv *env,
j9mem_free_memory(directoryChars);
}

j9mem_free_memory(syslogOptions);

VM_VMHelpers::setVMState(currentThread, oldVMState);
internalExitVMToJNI(currentThread);
#endif /* defined(LINUX) */
Expand Down

0 comments on commit 8f8e9c5

Please sign in to comment.