diff options
Diffstat (limited to 'qom/object_interfaces.c')
-rw-r--r-- | qom/object_interfaces.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 03a95c3..9c271ad 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -114,7 +114,7 @@ Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) QDict *pdict; Object *obj; const char *id = qemu_opts_id(opts); - const char *type = qemu_opt_get(opts, "qom-type"); + char *type = qemu_opt_get_del(opts, "qom-type"); if (!type) { error_setg(errp, QERR_MISSING_PARAMETER, "qom-type"); @@ -122,17 +122,19 @@ Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) } if (!id) { error_setg(errp, QERR_MISSING_PARAMETER, "id"); + g_free(type); return NULL; } + qemu_opts_set_id(opts, NULL); pdict = qemu_opts_to_qdict(opts, NULL); - qdict_del(pdict, "qom-type"); - qdict_del(pdict, "id"); v = opts_visitor_new(opts); obj = user_creatable_add_type(type, id, pdict, v, errp); visit_free(v); + qemu_opts_set_id(opts, (char *) id); + g_free(type); QDECREF(pdict); return obj; } |