8303181: Memory leak in ClassLoaderExt::setup_app_search_path

Reviewed-by: ccheung, dholmes
This commit is contained in:
Justin King 2023-03-03 18:07:40 +00:00
parent 29ee7c3b70
commit 40c5edfcc4

@ -67,7 +67,7 @@ void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) {
void ClassLoaderExt::setup_app_search_path(JavaThread* current) {
Arguments::assert_is_dumping_archive();
_app_class_paths_start_index = ClassLoader::num_boot_classpath_entries();
char* app_class_path = os::strdup(Arguments::get_appclasspath());
char* app_class_path = os::strdup_check_oom(Arguments::get_appclasspath(), mtClass);
if (strcmp(app_class_path, ".") == 0) {
// This doesn't make any sense, even for AppCDS, so let's skip it. We
@ -78,6 +78,8 @@ void ClassLoaderExt::setup_app_search_path(JavaThread* current) {
trace_class_path("app loader class path=", app_class_path);
ClassLoader::setup_app_search_path(current, app_class_path);
}
os::free(app_class_path);
}
void ClassLoaderExt::process_module_table(JavaThread* current, ModuleEntryTable* met) {