Index: native-src/shared/launcher/main.c =================================================================== --- native-src/shared/launcher/main.c.orig 2006-05-24 19:28:22.000000000 +0100 +++ native-src/shared/launcher/main.c 2006-05-24 19:40:58.000000000 +0100 @@ -116,7 +116,7 @@ char *vmiPath = NULL; char *newPathToAdd; char *propertiesFileName = NULL; - char *exeName; + char *exeName = NULL; char *exeBaseName; char *endPathPtr; UDATA handle; @@ -135,11 +135,13 @@ hysysinfo_get_executable_name (argv[0], &exeName); /* Pick out the file basename */ - exeBaseName = strrchr(exeName, HY_PATH_SLASH); + endPathPtr = exeBaseName = strrchr(exeName, HY_PATH_SLASH); if (exeBaseName == NULL) { exeBaseName = exeName; + endPathPtr = exeName; } else { exeBaseName += 1; + endPathPtr = exeBaseName; } /* Test whether we are likely the generic java launcher (or a tool) */ @@ -179,7 +181,7 @@ hyfile_printf (PORTLIB, HYPORT_TTY_OUT, HY_COPYRIGHT_STRING "\n"); hyfile_printf (PORTLIB, HYPORT_TTY_OUT, "java [-vm:vmdll -vmdir:dir -D... [-X...]] [args]\n"); - return 0; + goto bail; } /* We are the generic launcher, figure out if we have a main class @@ -201,7 +203,8 @@ /* We are being asked to print our version, and quit */ dumpVersionInfo (PORTLIB); hyfile_printf (PORTLIB, HYPORT_TTY_OUT, HY_COPYRIGHT_STRING "\n"); - return 0; + goto bail; + } if (0 == strcmp ("-showversion", argv[i])) { /* We are being asked to print our version and continue */ @@ -268,9 +271,7 @@ /* jvm dlls are located in a subdirectory off of jre/bin */ /* setup path to dll named in -vm argument */ - hysysinfo_get_executable_name (argv[0], &exeName); - endPathPtr = strrchr (exeName, DIR_SEPERATOR); - endPathPtr[1] = '\0'; + endPathPtr[0] = '\0'; newPathToAdd = hymem_allocate_memory (strlen (exeName) + strlen (vmdllsubdir) + 1); if (newPathToAdd == NULL) { /* HYNLS_EXELIB_INTERNAL_VM_ERR_OUT_OF_MEMORY=Internal VM error: Out of memory\n */ @@ -349,6 +350,10 @@ goto bail; } bail: + if (exeName) + { + hymem_free_memory (exeName); + } if (mainClass) { hymem_free_memory (mainClass);