diff options
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r-- | qdev-monitor.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c index b4abb4b5ea..2abb80d7e4 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -619,22 +619,22 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) /* set properties */ if (qemu_opt_foreach(opts, set_property, dev, &err)) { - error_propagate(errp, err); - object_unparent(OBJECT(dev)); - object_unref(OBJECT(dev)); - return NULL; + goto err_del_dev; } dev->opts = opts; object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err != NULL) { - error_propagate(errp, err); dev->opts = NULL; - object_unparent(OBJECT(dev)); - object_unref(OBJECT(dev)); - return NULL; + goto err_del_dev; } return dev; + +err_del_dev: + error_propagate(errp, err); + object_unparent(OBJECT(dev)); + object_unref(OBJECT(dev)); + return NULL; } |