Skip to content

Commit

Permalink
Merge pull request #13769 from tajila/criu3
Browse files Browse the repository at this point in the history
(0.29.1) Fix potential memory leaks
  • Loading branch information
pshipton committed Oct 27, 2021
2 parents 854d449 + 5f30ac0 commit 7786a44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions runtime/vm/createramclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2326,14 +2326,14 @@ trcModulesSettingPackage(J9VMThread *vmThread, J9Class *ramClass, J9ClassLoader
}
if ((NULL != classLoaderNameUTF) && (NULL != moduleNameUTF)) {
Trc_MODULE_setPackage(vmThread, J9UTF8_LENGTH(className), J9UTF8_DATA(className), classLoaderNameUTF, classLoader, moduleNameUTF, ramClass->module);
if (moduleNameBuf != moduleNameUTF) {
PORT_ACCESS_FROM_VMC(vmThread);
j9mem_free_memory(moduleNameUTF);
}
if (classLoaderNameBuf != classLoaderNameUTF) {
PORT_ACCESS_FROM_VMC(vmThread);
j9mem_free_memory(classLoaderNameUTF);
}
}
if (moduleNameBuf != moduleNameUTF) {
PORT_ACCESS_FROM_VMC(vmThread);
j9mem_free_memory(moduleNameUTF);
}
if (classLoaderNameBuf != classLoaderNameUTF) {
PORT_ACCESS_FROM_VMC(vmThread);
j9mem_free_memory(classLoaderNameUTF);
}
}

Expand Down
12 changes: 6 additions & 6 deletions runtime/vm/exceptiondescribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,6 @@ printStackTraceEntry(J9VMThread * vmThread, void * voidUserData, UDATA bytecodeO
moduleNameUTF, moduleVersionUTF,
sourceFileNameLen, sourceFileName,
lineNumber); /* line number will be ignored in if it's not used in the format string */
if (TRUE == freeModuleVersion) {
j9mem_free_memory(moduleVersionUTF);
}
if (TRUE == freeModuleName) {
j9mem_free_memory(moduleNameUTF);
}
} else {
if (0 != lineNumber) {
format = j9nls_lookup_message(
Expand All @@ -213,6 +207,12 @@ printStackTraceEntry(J9VMThread * vmThread, void * voidUserData, UDATA bytecodeO
sourceFileNameLen, sourceFileName,
lineNumber); /* line number will be ignored in if it's not used in the format string */
}
if (freeModuleVersion) {
j9mem_free_memory(moduleVersionUTF);
}
if (freeModuleName) {
j9mem_free_memory(moduleNameUTF);
}
}

return TRUE;
Expand Down

0 comments on commit 7786a44

Please sign in to comment.