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>
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index 42defe7..a16cefc 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -230,6 +230,13 @@
};
+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_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 @@
.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 @@
.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,
};