diff --git a/core/tiny_free_fast.inc.h b/core/tiny_free_fast.inc.h index 2858428b..f5fa5c09 100644 --- a/core/tiny_free_fast.inc.h +++ b/core/tiny_free_fast.inc.h @@ -241,8 +241,10 @@ static inline void tiny_free_fast(void* ptr) { // 2. Legacy TinySlab-backed pointer? TinySlab* slab = hak_tiny_owner_slab(ptr); if (__builtin_expect(slab != NULL, 0)) { - // Convert USER → BASE (for Legacy path) - void* base_legacy = (void*)((uint8_t*)ptr - 1); + // Convert USER → BASE (for Legacy path) using centralized layout + int legacy_class = slab->class_idx; + size_t user_off = tiny_user_offset(legacy_class); + void* base_legacy = (void*)((uint8_t*)ptr - user_off); // Box 6 Boundary: Try same-thread fast path // CRITICAL: Pass BASE pointer (already converted above)