[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/16] migration: fix QEMUFile leak
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PULL 14/16] migration: fix QEMUFile leak |
Date: |
Wed, 26 Sep 2018 18:12:34 +0100 |
From: Marc-André Lureau <address@hidden>
Spotted by ASAN while running:
$ tests/migration-test -p /x86_64/migration/postcopy/recovery
=================================================================
==18034==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 33864 byte(s) in 1 object(s) allocated from:
#0 0x7f3da7f31e50 in calloc (/lib64/libasan.so.5+0xeee50)
#1 0x7f3da644441d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
#2 0x55af9db15440 in qemu_fopen_channel_input
/home/elmarco/src/qemu/migration/qemu-file-channel.c:183
#3 0x55af9db15413 in channel_get_output_return_path
/home/elmarco/src/qemu/migration/qemu-file-channel.c:159
#4 0x55af9db0d4ac in qemu_file_get_return_path
/home/elmarco/src/qemu/migration/qemu-file.c:78
#5 0x55af9dad5e4f in open_return_path_on_source
/home/elmarco/src/qemu/migration/migration.c:2295
#6 0x55af9dadb3bf in migrate_fd_connect
/home/elmarco/src/qemu/migration/migration.c:3111
#7 0x55af9dae1bf3 in migration_channel_connect
/home/elmarco/src/qemu/migration/channel.c:91
#8 0x55af9daddeca in socket_outgoing_migration
/home/elmarco/src/qemu/migration/socket.c:108
#9 0x55af9e13d3db in qio_task_complete /home/elmarco/src/qemu/io/task.c:158
#10 0x55af9e13ca03 in qio_task_thread_result
/home/elmarco/src/qemu/io/task.c:89
#11 0x7f3da643b1ca in g_idle_dispatch gmain.c:5535
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Peter Xu <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
migration/migration.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/migration/migration.c b/migration/migration.c
index 6a7731de50..d6ae879dc8 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2280,7 +2280,10 @@ out:
*/
if (postcopy_pause_return_path_thread(ms)) {
/* Reload rp, reset the rest */
- rp = ms->rp_state.from_dst_file;
+ if (rp != ms->rp_state.from_dst_file) {
+ qemu_fclose(rp);
+ rp = ms->rp_state.from_dst_file;
+ }
ms->rp_state.error = false;
goto retry;
}
--
2.17.1
- [Qemu-devel] [PULL 04/16] Add a hint message to loadvm and exits on failure, (continued)
- [Qemu-devel] [PULL 04/16] Add a hint message to loadvm and exits on failure, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 03/16] migration: handle the error condition properly, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 05/16] migration: do not flush_compressed_data at the end of iteration, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 07/16] migration: use save_page_use_compression in flush_compressed_data, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 06/16] migration: show the statistics of compression, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 08/16] tests/migration: Convert x86 boot block compilation script into Makefile, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 09/16] tests/migration: Support cross compilation in generating boot header file, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 10/16] tests/migration: Add migration-test header file, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 11/16] migration/postcopy: Clear have_listen_thread, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 13/16] tests/migration: Speed up the test on ppc64, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 14/16] migration: fix QEMUFile leak,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PULL 15/16] migration: fix the compression code, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 12/16] migration: cleanup in error paths in loadvm, Dr. David Alan Gilbert (git), 2018/09/26
- [Qemu-devel] [PULL 16/16] migration/ram.c: Avoid taking address of fields in packed MultiFDInit_t struct, Dr. David Alan Gilbert (git), 2018/09/26
- Re: [Qemu-devel] [PULL 00/16] migration queue, Peter Maydell, 2018/09/28