diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2018-02-12 16:03:39 +0000 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2018-02-14 10:31:01 +0000 |
commit | b9ccaf6d74a2c2b055a843bc8c8aa3f8fcda7920 (patch) | |
tree | c9516ed690063ef088b026166d966a1e118062ce /migration | |
parent | 17ca7746d7fcb11e524fd70341506e7e5c5cb8c9 (diff) | |
download | qemu-b9ccaf6d74a2c2b055a843bc8c8aa3f8fcda7920.zip qemu-b9ccaf6d74a2c2b055a843bc8c8aa3f8fcda7920.tar.gz qemu-b9ccaf6d74a2c2b055a843bc8c8aa3f8fcda7920.tar.bz2 |
migration: Fix early failure cleanup
Avoid crash in cleanup after a very early migration failure
(possibly due to my 688a3dcba980bf01344a 'Route errors down ...')
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20180212160340.15333-2-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/ram.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/migration/ram.c b/migration/ram.c index 8333d8e..7095c10 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) |