[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/13] boot-order-test: fix memleaks in boot-order-test
From: |
Thomas Huth |
Subject: |
[PULL 05/13] boot-order-test: fix memleaks in boot-order-test |
Date: |
Mon, 3 Feb 2020 13:38:03 +0100 |
From: Pan Nengyuan <address@hidden>
It's not a big deal, but 'check qtest-ppc/ppc64' runs fail if sanitizers is
enabled.
The memory leak stack is as follow:
Direct leak of 128 byte(s) in 4 object(s) allocated from:
#0 0x7f11756f5970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7f1174f2549d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x556af05aa7da in mm_fw_cfg_init /mnt/sdb/qemu/tests/libqos/fw_cfg.c:119
#3 0x556af059f4f5 in read_boot_order_pmac
/mnt/sdb/qemu/tests/boot-order-test.c:137
#4 0x556af059efe2 in test_a_boot_order
/mnt/sdb/qemu/tests/boot-order-test.c:47
#5 0x556af059f2c0 in test_boot_orders
/mnt/sdb/qemu/tests/boot-order-test.c:59
#6 0x556af059f52d in test_pmac_oldworld_boot_order
/mnt/sdb/qemu/tests/boot-order-test.c:152
#7 0x7f1174f46cb9 (/lib64/libglib-2.0.so.0+0x73cb9)
#8 0x7f1174f46b73 (/lib64/libglib-2.0.so.0+0x73b73)
#9 0x7f1174f46b73 (/lib64/libglib-2.0.so.0+0x73b73)
#10 0x7f1174f46f71 in g_test_run_suite (/lib64/libglib-2.0.so.0+0x73f71)
#11 0x7f1174f46f94 in g_test_run (/lib64/libglib-2.0.so.0+0x73f94)
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Pan Nengyuan <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
---
tests/qtest/boot-order-test.c | 6 +++---
tests/qtest/libqos/fw_cfg.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/boot-order-test.c b/tests/qtest/boot-order-test.c
index a725bce729..4241304ff5 100644
--- a/tests/qtest/boot-order-test.c
+++ b/tests/qtest/boot-order-test.c
@@ -134,7 +134,7 @@ static void test_prep_boot_order(void)
static uint64_t read_boot_order_pmac(QTestState *qts)
{
- QFWCFG *fw_cfg = mm_fw_cfg_init(qts, 0xf0000510);
+ g_autoptr(QFWCFG) fw_cfg = mm_fw_cfg_init(qts, 0xf0000510);
return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE);
}
@@ -159,7 +159,7 @@ static void test_pmac_newworld_boot_order(void)
static uint64_t read_boot_order_sun4m(QTestState *qts)
{
- QFWCFG *fw_cfg = mm_fw_cfg_init(qts, 0xd00000510ULL);
+ g_autoptr(QFWCFG) fw_cfg = mm_fw_cfg_init(qts, 0xd00000510ULL);
return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE);
}
@@ -171,7 +171,7 @@ static void test_sun4m_boot_order(void)
static uint64_t read_boot_order_sun4u(QTestState *qts)
{
- QFWCFG *fw_cfg = io_fw_cfg_init(qts, 0x510);
+ g_autoptr(QFWCFG) fw_cfg = io_fw_cfg_init(qts, 0x510);
return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE);
}
diff --git a/tests/qtest/libqos/fw_cfg.h b/tests/qtest/libqos/fw_cfg.h
index 13325cc4ff..c6a7cf8cf0 100644
--- a/tests/qtest/libqos/fw_cfg.h
+++ b/tests/qtest/libqos/fw_cfg.h
@@ -49,4 +49,6 @@ static inline void pc_fw_cfg_uninit(QFWCFG *fw_cfg)
io_fw_cfg_uninit(fw_cfg);
}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QFWCFG, mm_fw_cfg_uninit)
+
#endif
--
2.18.1
- [PULL 00/13] qtests, kconfig and misc patches, Thomas Huth, 2020/02/03
- [PULL 02/13] tests/vhost-user-bridge: Fix build, Thomas Huth, 2020/02/03
- [PULL 01/13] test-logging: Fix -Werror=maybe-uninitialized warning, Thomas Huth, 2020/02/03
- [PULL 03/13] docs/devel: Fix qtest paths and info about check-block in testing.rst, Thomas Huth, 2020/02/03
- [PULL 04/13] tests/Makefile: Fix inclusion of the qos dependency files, Thomas Huth, 2020/02/03
- [PULL 06/13] tests/qtest: update comments about bios-tables-test-allowed-diff.h, Thomas Huth, 2020/02/03
- [PULL 05/13] boot-order-test: fix memleaks in boot-order-test,
Thomas Huth <=
- [PULL 08/13] hw/bt: Remove empty Kconfig file, Thomas Huth, 2020/02/03
- [PULL 09/13] hw/input: Do not enable CONFIG_PCKBD by default, Thomas Huth, 2020/02/03
- [PULL 07/13] gitlab-ci: Refresh the list of iotests, Thomas Huth, 2020/02/03
- [PULL 10/13] hw/hppa/Kconfig: LASI chipset requires PARALLEL port, Thomas Huth, 2020/02/03
- [PULL 12/13] include/sysemu/sysemu.h: Remove usused variable no_quit, Thomas Huth, 2020/02/03
- [PULL 13/13] trivial: Remove xenfb_enabled from sysemu.h, Thomas Huth, 2020/02/03
- [PULL 11/13] hw/*/Makefile.objs: Move many .o files to common-objs, Thomas Huth, 2020/02/03
- Re: [PULL 00/13] qtests, kconfig and misc patches, Peter Maydell, 2020/02/03