summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-07-07 21:49:41 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2016-09-08 17:57:32 +0400
commit3972a4884ddffcdd1037f5ec2a5a514784bdcec9 (patch)
treec50f9a49e6ab47ac856d4db1eeb7883845001abb
parent265804b5d755502438b4d42a3682f54e03ea4d32 (diff)
downloadqemu-3972a4884ddffcdd1037f5ec2a5a514784bdcec9.tar.gz
qemu-3972a4884ddffcdd1037f5ec2a5a514784bdcec9.tar.bz2
qemu-3972a4884ddffcdd1037f5ec2a5a514784bdcec9.zip
tests: fix check-qom-proplist leaks
Found thanks to ASAN. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
-rw-r--r--tests/check-qom-proplist.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index 42defe7128..a16cefca73 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -230,6 +230,13 @@ struct DummyBackendClass {
};
+static void dummy_dev_finalize(Object *obj)
+{
+ DummyDev *dev = DUMMY_DEV(obj);
+
+ object_unref(OBJECT(dev->bus));
+}
+
static void dummy_dev_init(Object *obj)
{
DummyDev *dev = DUMMY_DEV(obj);
@@ -257,6 +264,13 @@ static void dummy_dev_class_init(ObjectClass *klass, void *opaque)
}
+static void dummy_bus_finalize(Object *obj)
+{
+ DummyBus *bus = DUMMY_BUS(obj);
+
+ object_unref(OBJECT(bus->backend));
+}
+
static void dummy_bus_init(Object *obj)
{
}
@@ -283,6 +297,7 @@ static const TypeInfo dummy_dev_info = {
.parent = TYPE_OBJECT,
.instance_size = sizeof(DummyDev),
.instance_init = dummy_dev_init,
+ .instance_finalize = dummy_dev_finalize,
.class_size = sizeof(DummyDevClass),
.class_init = dummy_dev_class_init,
};
@@ -292,6 +307,7 @@ static const TypeInfo dummy_bus_info = {
.parent = TYPE_OBJECT,
.instance_size = sizeof(DummyBus),
.instance_init = dummy_bus_init,
+ .instance_finalize = dummy_bus_finalize,
.class_size = sizeof(DummyBusClass),
.class_init = dummy_bus_class_init,
};