# HG changeset patch # User ddmitriev # Date 1439116704 -10800 # Node ID be9ac7dad7613ddf5ef32286178d37c5c677d934 # Parent ced75b2e81d448cd0cef4aa4585934185c023631 8132892: Memory must be freed after calling Arguments::set_sysclasspath function Summary: Free memory after calling set_sysclasspath Reviewed-by: dholmes, dcubed diff -r ced75b2e81d4 -r be9ac7dad761 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Fri Aug 07 17:14:26 2015 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Sun Aug 09 13:38:24 2015 +0300 @@ -3305,7 +3305,9 @@ if (scp_assembly_required) { // Assemble the bootclasspath elements into the final path. - Arguments::set_sysclasspath(scp_p->combined_path()); + char *combined_path = scp_p->combined_path(); + Arguments::set_sysclasspath(combined_path); + FREE_C_HEAP_ARRAY(char, combined_path); } // This must be done after all arguments have been processed. diff -r ced75b2e81d4 -r be9ac7dad761 hotspot/src/share/vm/runtime/os.cpp --- a/hotspot/src/share/vm/runtime/os.cpp Fri Aug 07 17:14:26 2015 -0700 +++ b/hotspot/src/share/vm/runtime/os.cpp Sun Aug 09 13:38:24 2015 +0300 @@ -1271,6 +1271,7 @@ bool has_jimage = (os::stat(jimage, &st) == 0); if (has_jimage) { Arguments::set_sysclasspath(jimage); + FREE_C_HEAP_ARRAY(char, jimage); return true; } FREE_C_HEAP_ARRAY(char, jimage); @@ -1282,6 +1283,7 @@ sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep); } } + FREE_C_HEAP_ARRAY(char, modules_dir); // fallback to classes if (sysclasspath == NULL) @@ -1289,6 +1291,7 @@ if (sysclasspath == NULL) return false; Arguments::set_sysclasspath(sysclasspath); + FREE_C_HEAP_ARRAY(char, sysclasspath); return true; }