mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
migration: provide ram_state_cleanup
There are two Mutexes that are created but not yet destroyed for RAMState. Fix that. Since we are at it, provide helper function to clean up RAMState. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
7d00ee6ad6
commit
7d7c96be7b
1 changed files with 10 additions and 3 deletions
|
@ -1576,6 +1576,15 @@ static void xbzrle_load_cleanup(void)
|
||||||
XBZRLE.decoded_buf = NULL;
|
XBZRLE.decoded_buf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ram_state_cleanup(RAMState **rsp)
|
||||||
|
{
|
||||||
|
migration_page_queue_free(*rsp);
|
||||||
|
qemu_mutex_destroy(&(*rsp)->bitmap_mutex);
|
||||||
|
qemu_mutex_destroy(&(*rsp)->src_page_req_mutex);
|
||||||
|
g_free(*rsp);
|
||||||
|
*rsp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void ram_save_cleanup(void *opaque)
|
static void ram_save_cleanup(void *opaque)
|
||||||
{
|
{
|
||||||
RAMState **rsp = opaque;
|
RAMState **rsp = opaque;
|
||||||
|
@ -1605,10 +1614,8 @@ static void ram_save_cleanup(void *opaque)
|
||||||
XBZRLE.zero_target_page = NULL;
|
XBZRLE.zero_target_page = NULL;
|
||||||
}
|
}
|
||||||
XBZRLE_cache_unlock();
|
XBZRLE_cache_unlock();
|
||||||
migration_page_queue_free(*rsp);
|
|
||||||
compress_threads_save_cleanup();
|
compress_threads_save_cleanup();
|
||||||
g_free(*rsp);
|
ram_state_cleanup(rsp);
|
||||||
*rsp = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ram_state_reset(RAMState *rs)
|
static void ram_state_reset(RAMState *rs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue