diff --git a/hw/qdev.c b/hw/qdev.c index 6a8f6bda2b..af419b9c13 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -150,6 +150,7 @@ int qdev_init(DeviceState *dev) rc = dc->init(dev); if (rc < 0) { + object_unparent(OBJECT(dev)); qdev_free(dev); return rc; }