Jinoh Kang (@iamahuman) commented about dlls/ntdll/heap.c:
+ + if (!(block_get_flags( block ) & BLOCK_FLAG_LFH)) return STATUS_UNSUCCESSFUL; + + bin = heap->bins + BLOCK_SIZE_BIN( block_size ); + if (bin == last) return STATUS_UNSUCCESSFUL; + + i = block_get_group_index( block ); + valgrind_make_writable( block, sizeof(*block) ); + block_set_type( block, BLOCK_TYPE_FREE ); + block_set_flags( block, ~BLOCK_FLAG_LFH, BLOCK_FLAG_FREE ); + mark_block_free( block + 1, (char *)block + block_size - (char *)(block + 1), flags ); + + /* if this was the last used block in a group and GROUP_FLAG_FREE was set */ + if (InterlockedOr( &group->free_bits, 1 << i ) == ~(1 << i)) + { + /* thread now owns the group, and can release it to its bin */ `[free-unset-v7]`
/* thread now owns the group, and can release it to its bin */
WriteRelease( &group->free_bits, ~GROUP_FLAG_FREE );
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1628#note_23419