Skip to content

Commit

Permalink
memory: abort if a memory region is destroyed during a transaction
Browse files Browse the repository at this point in the history
Destroying a memory region is illegal within a transaction, as until
the transaction is committed, the memory core may hold references to
the region.  Add an assert to check for violations of this rule.

Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
avikivity committed Oct 17, 2012
1 parent 2725aec commit 2be0e25
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ void memory_region_init_reservation(MemoryRegion *mr,
void memory_region_destroy(MemoryRegion *mr)
{
assert(QTAILQ_EMPTY(&mr->subregions));
assert(memory_region_transaction_depth == 0);
mr->destructor(mr);
memory_region_clear_coalescing(mr);
g_free((char *)mr->name);
Expand Down

0 comments on commit 2be0e25

Please sign in to comment.