]> Git Repo - qemu.git/commitdiff
migration: provide ram_state_cleanup
authorPeter Xu <[email protected]>
Thu, 19 Oct 2017 06:31:58 +0000 (14:31 +0800)
committerJuan Quintela <[email protected]>
Mon, 23 Oct 2017 16:03:36 +0000 (18:03 +0200)
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 <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
migration/ram.c

index 13f4b3d10182bdde602f172c9317ed43680cce8e..d91e8787ae69b46fc73ff48f676df3a69d946efa 100644 (file)
@@ -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)
This page took 0.02862 seconds and 4 git commands to generate.