mirror of
https://github.com/corda/corda.git
synced 2025-04-16 07:27:17 +00:00
fix incorrect argument marshalling in Unsafe.{allocate|free}Memory
This was causing UnsafeTest to crash on PowerPC.
This commit is contained in:
parent
b0dd39aa86
commit
2107a09623
@ -332,7 +332,8 @@ extern "C" JNIEXPORT int64_t JNICALL
|
||||
Avian_sun_misc_Unsafe_allocateMemory
|
||||
(Thread* t, object, uintptr_t* arguments)
|
||||
{
|
||||
void* p = malloc(arguments[1]);
|
||||
int64_t size; memcpy(&size, arguments + 1, 8);
|
||||
void* p = malloc(size);
|
||||
if (p) {
|
||||
return reinterpret_cast<int64_t>(p);
|
||||
} else {
|
||||
@ -344,9 +345,9 @@ extern "C" JNIEXPORT void JNICALL
|
||||
Avian_sun_misc_Unsafe_freeMemory
|
||||
(Thread*, object, uintptr_t* arguments)
|
||||
{
|
||||
void* p = reinterpret_cast<void*>(arguments[1]);
|
||||
int64_t p; memcpy(&p, arguments + 1, 8);
|
||||
if (p) {
|
||||
free(p);
|
||||
free(reinterpret_cast<void*>(p));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user