Jinoh Kang (@iamahuman) commented about dlls/ntdll/heap.c:
block_set_base( block, subheap_base( subheap ) ); block_set_flags( block, ~0, BLOCK_FLAG_FREE ); block_set_size( block, block_size );
/* If debugging, erase the freed block content */
if (end > commit_end) end = commit_end;
if (end > (char *)(entry + 1)) mark_block_free( entry + 1, end - (char *)(entry + 1), flags );
- if (!subheap) /* LFH block initialization, just clear its data */
mark_block_free( entry + 1, (char *)block + block_size - (char *)(entry + 1), flags );
- else
- {
const char *end = (char *)block + block_size, *commit_end;
block_set_base( block, subheap_base( subheap ) );
if (end > (commit_end = subheap_commit_end( subheap ))) end = commit_end;
if (end > (char *)(entry + 1)) mark_block_free( entry + 1, end - (char *)(entry + 1), flags );
Can we somehow delete the `if (end > (char *)(entry + 1))` guard and merge with `!subheap` case?