diff mbox series

[PULL,2/6] cpu-plug-test: fix leaks

Message ID 20191112064332.5074-3-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,1/6] qtest: fix qtest_qmp_device_add leak | expand

Commit Message

Thomas Huth Nov. 12, 2019, 6:43 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20191107192731.17330-4-marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Fixes: 021a007efc3 ("cpu-plug-test: fix device_add for pc/q35 machines")
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/cpu-plug-test.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
index 058cef5ac1..30e514bbfb 100644
--- a/tests/cpu-plug-test.c
+++ b/tests/cpu-plug-test.c
@@ -99,6 +99,7 @@  static void test_plug_with_device_add(gconstpointer data)
 
         cpu = qobject_to(QDict, e);
         if (qdict_haskey(cpu, "qom-path")) {
+            qobject_unref(e);
             continue;
         }
 
@@ -107,6 +108,7 @@  static void test_plug_with_device_add(gconstpointer data)
 
         qtest_qmp_device_add_qdict(qts, td->device_model, props);
         hotplugged++;
+        qobject_unref(e);
     }
 
     /* make sure that there were hotplugged CPUs */