[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/15] test-vmstate: Fix memleaks in test_load_qlist
From: |
Juan Quintela |
Subject: |
[PULL 10/15] test-vmstate: Fix memleaks in test_load_qlist |
Date: |
Fri, 28 Feb 2020 10:24:15 +0100 |
From: Chen Qun <address@hidden>
There is memleak in test_load_qlist().It's not a big deal,
but test-vmstate will fail if sanitizers is enabled.
In addition, "ret" is written twice with the same value
in test_gtree_load_iommu().
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Chen Qun <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
tests/test-vmstate.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index cea363dd69..f7b3868881 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -1241,7 +1241,6 @@ static void test_gtree_load_iommu(void)
TestGTreeIOMMU *orig_iommu = create_iommu();
QEMUFile *fsave, *fload;
char eof;
- int ret;
fsave = open_test_file(true);
qemu_put_buffer(fsave, iommu_dump, sizeof(iommu_dump));
@@ -1250,10 +1249,8 @@ static void test_gtree_load_iommu(void)
fload = open_test_file(false);
vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1);
- ret = qemu_file_get_error(fload);
eof = qemu_get_byte(fload);
- ret = qemu_file_get_error(fload);
- g_assert(!ret);
+ g_assert(!qemu_file_get_error(fload));
g_assert_cmpint(orig_iommu->id, ==, dest_iommu->id);
g_assert_cmpint(eof, ==, QEMU_VM_EOF);
@@ -1395,6 +1392,7 @@ static void test_load_qlist(void)
compare_containers(orig_container, dest_container);
free_container(orig_container);
free_container(dest_container);
+ qemu_fclose(fload);
}
typedef struct TmpTestStruct {
--
2.24.1
- [PULL 00/15] Pull migration patches, Juan Quintela, 2020/02/28
- [PULL 01/15] multifd: Add multifd-compression parameter, Juan Quintela, 2020/02/28
- [PULL 02/15] migration: Add support for modules, Juan Quintela, 2020/02/28
- [PULL 03/15] multifd: Make no compression operations into its own structure, Juan Quintela, 2020/02/28
- [PULL 04/15] multifd: Add multifd-zlib-level parameter, Juan Quintela, 2020/02/28
- [PULL 06/15] configure: Enable test and libs for zstd, Juan Quintela, 2020/02/28
- [PULL 05/15] multifd: Add zlib compression multifd support, Juan Quintela, 2020/02/28
- [PULL 07/15] multifd: Add multifd-zstd-level parameter, Juan Quintela, 2020/02/28
- [PULL 08/15] multifd: Add zstd compression multifd support, Juan Quintela, 2020/02/28
- [PULL 09/15] migration/vmstate: Remove redundant statement in vmstate_save_state_v(), Juan Quintela, 2020/02/28
- [PULL 10/15] test-vmstate: Fix memleaks in test_load_qlist,
Juan Quintela <=
- [PULL 11/15] migration/savevm: release gslist after dump_vmstate_json, Juan Quintela, 2020/02/28
- [PULL 12/15] migration/block: rename BLOCK_SIZE macro, Juan Quintela, 2020/02/28
- [PULL 13/15] migration: fix COLO broken caused by a previous commit, Juan Quintela, 2020/02/28
- [PULL 14/15] migration/colo: wrap incoming checkpoint process into new helper, Juan Quintela, 2020/02/28
- [PULL 15/15] savevm: Don't call colo_init_ram_cache twice, Juan Quintela, 2020/02/28
- Re: [PULL 00/15] Pull migration patches, Peter Maydell, 2020/02/28