Commit 27efa614 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Code correction; Add 0x prefix to JVM errors.

parent e3598afe
......@@ -50,9 +50,12 @@ sjme_jboolean sjme_packOpen(sjme_packInstance** outInstance,
if (instance->driver->initInstance == NULL ||
!instance->driver->initInstance(instance))
{
/* Before we free, set this away. */
sjme_setError(error, SJME_ERROR_BAD_DRIVER_INIT,
instance->driver->initInstance == NULL);
sjme_free(instance, error);
sjme_setError(error, SJME_ERROR_BAD_DRIVER_INIT, 0);
return sjme_false;
}
......
......@@ -131,6 +131,7 @@ void* sjme_realloc(void* ptr, sjme_jint size, sjme_error* error)
void sjme_free(void* p, sjme_error* error)
{
void* baseP;
sjme_jint size;
/* Ignore null pointers. */
if (p == NULL)
......@@ -141,6 +142,10 @@ void sjme_free(void* p, sjme_error* error)
/* Base pointer which is size shifted. */
baseP = SJME_POINTER_OFFSET_LONG(p, -4);
size = *((sjme_jint*)(baseP));
/* Wipe memory that was here. */
memset(baseP, 0xBA, size);
#if defined(__palmos__)
/* Use Palm OS free. */
......
......@@ -119,7 +119,7 @@ void sjme_describeJvmError(sjme_error* error,
/* Build error string out. */
readLen = snprintf(destMessage, *destLen,
"JVM Error: %s (%d) %d/%x",
"JVM Error: %s (%d) %d/0x%x",
stringy->string,
error->code,
error->value,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment