]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
cpu-plug-test: fix leaks
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 7 Nov 2019 19:27:31 +0000 (23:27 +0400)
committerThomas Huth <thuth@redhat.com>
Mon, 11 Nov 2019 12:02:30 +0000 (13:02 +0100)
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

index 058cef5ac181752281f3bfcd0108b00dcaa3426a..30e514bbfbd6bb433a7ee1c05273304c3932e893 100644 (file)
@@ -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 */