Skip to content

Commit 40c5edf

Browse files
committed
8303181: Memory leak in ClassLoaderExt::setup_app_search_path
Reviewed-by: ccheung, dholmes
1 parent 29ee7c3 commit 40c5edf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/hotspot/share/classfile/classLoaderExt.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) {
6767
void ClassLoaderExt::setup_app_search_path(JavaThread* current) {
6868
Arguments::assert_is_dumping_archive();
6969
_app_class_paths_start_index = ClassLoader::num_boot_classpath_entries();
70-
char* app_class_path = os::strdup(Arguments::get_appclasspath());
70+
char* app_class_path = os::strdup_check_oom(Arguments::get_appclasspath(), mtClass);
7171

7272
if (strcmp(app_class_path, ".") == 0) {
7373
// 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) {
7878
trace_class_path("app loader class path=", app_class_path);
7979
ClassLoader::setup_app_search_path(current, app_class_path);
8080
}
81+
82+
os::free(app_class_path);
8183
}
8284

8385
void ClassLoaderExt::process_module_table(JavaThread* current, ModuleEntryTable* met) {

0 commit comments

Comments
 (0)