summary refs log tree commit diff stats
path: root/migration/multifd-nocomp.c
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2025-03-04 23:03:40 +0100
committerCédric Le Goater <clg@redhat.com>2025-03-06 06:47:33 +0100
commit7ecfab1ddd3e6678c6a0b12d348d82cfaaa406ff (patch)
tree80f851241c388086b5b0edd3e5ed01c02ae413f4 /migration/multifd-nocomp.c
parentd19cc4dca0b21af95fee36a2ddad34eb4bd6b67f (diff)
downloadfocaccia-qemu-7ecfab1ddd3e6678c6a0b12d348d82cfaaa406ff.tar.gz
focaccia-qemu-7ecfab1ddd3e6678c6a0b12d348d82cfaaa406ff.zip
migration/multifd: Add an explicit MultiFDSendData destructor
This way if there are fields there that needs explicit disposal (like, for
example, some attached buffers) they will be handled appropriately.

Add a related assert to multifd_set_payload_type() in order to make sure
that this function is only used to fill a previously empty MultiFDSendData
with some payload, not the other way around.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Link: https://lore.kernel.org/qemu-devel/6755205f2b95abbed251f87061feee1c0e410836.1741124640.git.maciej.szmigiero@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'migration/multifd-nocomp.c')
-rw-r--r--migration/multifd-nocomp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/migration/multifd-nocomp.c b/migration/multifd-nocomp.c
index 1325dba97c..e46e79d8b2 100644
--- a/migration/multifd-nocomp.c
+++ b/migration/multifd-nocomp.c
@@ -42,8 +42,7 @@ void multifd_ram_save_setup(void)
 
 void multifd_ram_save_cleanup(void)
 {
-    g_free(multifd_ram_send);
-    multifd_ram_send = NULL;
+    g_clear_pointer(&multifd_ram_send, multifd_send_data_free);
 }
 
 static void multifd_set_file_bitmap(MultiFDSendParams *p)