aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2017-10-19 14:31:58 +0800
committerJuan Quintela <quintela@redhat.com>2017-10-23 18:03:36 +0200
commit7d7c96be7b25f285b3759ec0545bbe82dd0d8076 (patch)
treec60b22a87307e6251b5d1a89d0b3ad2bc899258d /migration
parent7d00ee6ad6c2dbeeb68e8d5343ec77bc5873d8f8 (diff)
downloadqemu-7d7c96be7b25f285b3759ec0545bbe82dd0d8076.zip
qemu-7d7c96be7b25f285b3759ec0545bbe82dd0d8076.tar.gz
qemu-7d7c96be7b25f285b3759ec0545bbe82dd0d8076.tar.bz2
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>
Diffstat (limited to 'migration')
-rw-r--r--migration/ram.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 13f4b3d..d91e878 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1576,6 +1576,15 @@ static void xbzrle_load_cleanup(void)
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)
{
RAMState **rsp = opaque;
@@ -1605,10 +1614,8 @@ static void ram_save_cleanup(void *opaque)
XBZRLE.zero_target_page = NULL;
}
XBZRLE_cache_unlock();
- migration_page_queue_free(*rsp);
compress_threads_save_cleanup();
- g_free(*rsp);
- *rsp = NULL;
+ ram_state_cleanup(rsp);
}
static void ram_state_reset(RAMState *rs)