Fixing property copying

This commit is contained in:
Vasily Litvinov 2014-04-09 16:02:48 +04:00
parent 6e3b170393
commit 5828ef1d46

View File

@ -3155,14 +3155,6 @@ Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
populateJNITables(&javaVMVTable, &jniEnvVTable);
const char* bootstrapProperty = findProperty(this, BOOTSTRAP_PROPERTY);
const char* bootstrapPropertyDup = bootstrapProperty ? strdup(bootstrapProperty) : 0;
const char* bootstrapPropertyEnd = bootstrapPropertyDup + (bootstrapPropertyDup ? strlen(bootstrapPropertyDup) : 0);
char* codeLibraryName = (char*)bootstrapPropertyDup;
char* codeLibraryNameEnd = 0;
if (codeLibraryName && (codeLibraryNameEnd = strchr(codeLibraryName, system->pathSeparator())))
*codeLibraryNameEnd = 0;
// Copying the properties memory (to avoid memory crashes)
this->properties = (char**)heap->allocate(sizeof(char*) * propertyCount);
for (unsigned int i = 0; i < propertyCount; i++)
@ -3171,6 +3163,14 @@ Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
strcpy(this->properties[i], properties[i]);
}
const char* bootstrapProperty = findProperty(this, BOOTSTRAP_PROPERTY);
const char* bootstrapPropertyDup = bootstrapProperty ? strdup(bootstrapProperty) : 0;
const char* bootstrapPropertyEnd = bootstrapPropertyDup + (bootstrapPropertyDup ? strlen(bootstrapPropertyDup) : 0);
char* codeLibraryName = (char*)bootstrapPropertyDup;
char* codeLibraryNameEnd = 0;
if (codeLibraryName && (codeLibraryNameEnd = strchr(codeLibraryName, system->pathSeparator())))
*codeLibraryNameEnd = 0;
if (not system->success(system->make(&localThread)) or
not system->success(system->make(&stateLock)) or
not system->success(system->make(&heapLock)) or