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>
This commit is contained in:
Marc-André Lureau 2016-07-07 21:49:41 +02:00
parent 265804b5d7
commit 3972a4884d

View File

@ -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) static void dummy_dev_init(Object *obj)
{ {
DummyDev *dev = DUMMY_DEV(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) static void dummy_bus_init(Object *obj)
{ {
} }
@ -283,6 +297,7 @@ static const TypeInfo dummy_dev_info = {
.parent = TYPE_OBJECT, .parent = TYPE_OBJECT,
.instance_size = sizeof(DummyDev), .instance_size = sizeof(DummyDev),
.instance_init = dummy_dev_init, .instance_init = dummy_dev_init,
.instance_finalize = dummy_dev_finalize,
.class_size = sizeof(DummyDevClass), .class_size = sizeof(DummyDevClass),
.class_init = dummy_dev_class_init, .class_init = dummy_dev_class_init,
}; };
@ -292,6 +307,7 @@ static const TypeInfo dummy_bus_info = {
.parent = TYPE_OBJECT, .parent = TYPE_OBJECT,
.instance_size = sizeof(DummyBus), .instance_size = sizeof(DummyBus),
.instance_init = dummy_bus_init, .instance_init = dummy_bus_init,
.instance_finalize = dummy_bus_finalize,
.class_size = sizeof(DummyBusClass), .class_size = sizeof(DummyBusClass),
.class_init = dummy_bus_class_init, .class_init = dummy_bus_class_init,
}; };