mirror of https://github.com/mgba-emu/mgba.git
VFS: Fix UB
This commit is contained in:
parent
7b0e400710
commit
c0a323dbcd
|
@ -94,12 +94,12 @@ static void _vd7zFree(ISzAllocPtr p, void* address) {
|
||||||
struct VDir7zAlloc* alloc = (struct VDir7zAlloc*) p;
|
struct VDir7zAlloc* alloc = (struct VDir7zAlloc*) p;
|
||||||
size_t size = (size_t) TableLookup(&alloc->allocs, (uintptr_t) address >> 2);
|
size_t size = (size_t) TableLookup(&alloc->allocs, (uintptr_t) address >> 2);
|
||||||
if (size) {
|
if (size) {
|
||||||
|
TableRemove(&alloc->allocs, (uintptr_t) address >> 2);
|
||||||
if (size >= 0x10000) {
|
if (size >= 0x10000) {
|
||||||
mappedMemoryFree(address, size);
|
mappedMemoryFree(address, size);
|
||||||
} else {
|
} else {
|
||||||
free(address);
|
free(address);
|
||||||
}
|
}
|
||||||
TableRemove(&alloc->allocs, (uintptr_t) address >> 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue