VFS: Fix UB

This commit is contained in:
Vicki Pfau 2024-01-30 02:37:48 -08:00
parent 7b0e400710
commit c0a323dbcd
1 changed files with 1 additions and 1 deletions

View File

@ -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);
} }
} }