Jinoh Kang (@iamahuman) commented about dlls/ntdll/heap.c:
if ((ULONG_PTR)ptr % BLOCK_ALIGN) err = "invalid ptr alignment";
- else if (block_get_flags( block ) & BLOCK_FLAG_LFH)
- {
/* LFH blocks base points to the group, not the subheap */
if (block_get_type( block ) == BLOCK_TYPE_DEAD)
err = "delayed freed block";
else if (block_get_type( block ) == BLOCK_TYPE_FREE)
err = "already freed block";
else if (block_get_type( block ) != BLOCK_TYPE_USED)
err = "invalid block type";
- }
I think it helps readability to hoist the type checks (dead and free) common to both LFH and non-LFH.
```suggestion:-9+0 else if (block_get_type( block ) == BLOCK_TYPE_DEAD) err = "delayed freed block"; else if (block_get_type( block ) == BLOCK_TYPE_FREE) err = "already freed block"; else if (block_get_flags( block ) & BLOCK_FLAG_LFH) { if (block_get_type( block ) != BLOCK_TYPE_USED) err = "invalid block type";
/* NOTE: A LFH block does not have a subheap (its base points to a group instead) */ } ```