From: twisti Date: Wed, 22 Aug 2007 19:59:32 +0000 (+0000) Subject: * src/vm/vm.c (vm_create): Free properties after they have been X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=7d1c9b4c78497f11ebf621cd15ca9cbc46976273;p=cacao.git * src/vm/vm.c (vm_create): Free properties after they have been replaced. * src/vmcore/suck.c (suck_add_from_property): Likewise. * src/vm/properties.c (properties_set): Smaller changes. --- diff --git a/src/vm/properties.c b/src/vm/properties.c index 91cb5e875..b2276f35c 100644 --- a/src/vm/properties.c +++ b/src/vm/properties.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: properties.c 8402 2007-08-22 19:32:27Z twisti $ + $Id: properties.c 8403 2007-08-22 19:59:32Z twisti $ */ @@ -337,7 +337,7 @@ void properties_set(void) boot_class_path = MNEW(char, len); - strcat(boot_class_path, CLASSPATH_CLASSES); + strcpy(boot_class_path, CLASSPATH_CLASSES); # else # error unknown classpath configuration @@ -345,8 +345,8 @@ void properties_set(void) #endif } - properties_add("java.boot.class.path", boot_class_path); properties_add("sun.boot.class.path", boot_class_path); + properties_add("java.boot.class.path", boot_class_path); #if defined(ENABLE_JAVASE) diff --git a/src/vm/vm.c b/src/vm/vm.c index 99fc24305..8978290f1 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: vm.c 8401 2007-08-22 18:45:31Z twisti $ + $Id: vm.c 8403 2007-08-22 19:59:32Z twisti $ */ @@ -869,8 +869,6 @@ bool vm_create(JavaVMInitArgs *vm_args) class_path = properties_get("java.class.path"); - MFREE(class_path, char, len); - p = MNEW(char, strlen(opt_arg) + strlen("0")); strcpy(p, opt_arg); @@ -878,6 +876,8 @@ bool vm_create(JavaVMInitArgs *vm_args) #if defined(ENABLE_JAVASE) properties_add("java.class.path", p); #endif + + MFREE(class_path, char, strlen(class_path)); break; case OPT_D: @@ -902,8 +902,6 @@ bool vm_create(JavaVMInitArgs *vm_args) boot_class_path = properties_get("sun.boot.class.path"); - MFREE(boot_class_path, char, len); - p = MNEW(char, strlen(opt_arg) + strlen("0")); strcpy(p, opt_arg); @@ -912,6 +910,8 @@ bool vm_create(JavaVMInitArgs *vm_args) properties_add("sun.boot.class.path", p); properties_add("java.boot.class.path", p); #endif + + MFREE(boot_class_path, char, strlen(boot_class_path)); break; case OPT_BOOTCLASSPATH_A: @@ -949,12 +949,12 @@ bool vm_create(JavaVMInitArgs *vm_args) strcat(p, ":"); strcat(p, boot_class_path); - MFREE(boot_class_path, char, len); - #if defined(ENABLE_JAVASE) properties_add("sun.boot.class.path", p); properties_add("java.boot.class.path", p); #endif + + MFREE(boot_class_path, char, len); break; case OPT_BOOTCLASSPATH_C: @@ -963,8 +963,6 @@ bool vm_create(JavaVMInitArgs *vm_args) boot_class_path = properties_get("sun.boot.class.path"); - MFREE(boot_class_path, char, strlen(boot_class_path)); - len = strlen(CACAO_VM_ZIP) + strlen(":") + @@ -981,6 +979,8 @@ bool vm_create(JavaVMInitArgs *vm_args) properties_add("sun.boot.class.path", p); properties_add("java.boot.class.path", p); #endif + + MFREE(boot_class_path, char, strlen(boot_class_path)); break; #if defined(ENABLE_JVMTI) diff --git a/src/vmcore/suck.c b/src/vmcore/suck.c index 95c7a94db..a8a8400a3 100644 --- a/src/vmcore/suck.c +++ b/src/vmcore/suck.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: suck.c 8399 2007-08-22 18:24:23Z twisti $ + $Id: suck.c 8403 2007-08-22 19:59:32Z twisti $ */ @@ -312,13 +312,13 @@ void suck_add_from_property(char *key) strcat(p, ":"); strcat(p, boot_class_path); - MFREE(boot_class_path, u1, strlen(boot_class_path)); - #if defined(ENABLE_JAVASE) properties_add("sun.boot.class.path", p); properties_add("java.boot.class.path", p); #endif + MFREE(boot_class_path, char, strlen(boot_class_path)); + /* free the memory allocated by scandir */ /* (We use `free` as the memory came from the C library.) */