summaryrefslogtreecommitdiff
path: root/migration/ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'migration/ram.c')
-rw-r--r--migration/ram.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 8333d8e35e..7095c1040e 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1602,11 +1602,13 @@ static void xbzrle_load_cleanup(void)
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;
+ if (*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 xbzrle_cleanup(void)