8132892: Memory must be freed after calling Arguments::set_sysclasspath function

Free memory after calling set_sysclasspath

Reviewed-by: dholmes, dcubed
This commit is contained in:
Dmitry Dmitriev 2015-08-09 13:38:24 +03:00
parent 15b4d3eff9
commit d364e5d191
2 changed files with 6 additions and 1 deletions

View File

@ -3305,7 +3305,9 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req
if (scp_assembly_required) { if (scp_assembly_required) {
// Assemble the bootclasspath elements into the final path. // 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. // This must be done after all arguments have been processed.

View File

@ -1271,6 +1271,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
bool has_jimage = (os::stat(jimage, &st) == 0); bool has_jimage = (os::stat(jimage, &st) == 0);
if (has_jimage) { if (has_jimage) {
Arguments::set_sysclasspath(jimage); Arguments::set_sysclasspath(jimage);
FREE_C_HEAP_ARRAY(char, jimage);
return true; return true;
} }
FREE_C_HEAP_ARRAY(char, jimage); FREE_C_HEAP_ARRAY(char, jimage);
@ -1282,6 +1283,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep); sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep);
} }
} }
FREE_C_HEAP_ARRAY(char, modules_dir);
// fallback to classes // fallback to classes
if (sysclasspath == NULL) if (sysclasspath == NULL)
@ -1289,6 +1291,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
if (sysclasspath == NULL) return false; if (sysclasspath == NULL) return false;
Arguments::set_sysclasspath(sysclasspath); Arguments::set_sysclasspath(sysclasspath);
FREE_C_HEAP_ARRAY(char, sysclasspath);
return true; return true;
} }