@@ -281,7 +281,6 @@ DeviceState *qdev_device_add(QemuOpts *opts)
qerror_report(QERR_DEVICE_INIT_FAILED, driver);
return NULL;
}
- qdev->opts = opts;
return qdev;
}
@@ -410,8 +409,6 @@ void qdev_free(DeviceState *dev)
vmstate_unregister(dev, dev->info->vmsd, dev);
if (dev->info->exit)
dev->info->exit(dev);
- if (dev->opts)
- qemu_opts_del(dev->opts);
}
QLIST_REMOVE(dev, sibling);
g_free(dev->id);
@@ -921,6 +918,8 @@ int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
qemu_opts_del(opts);
return -1;
}
+ qemu_opts_del(opts);
+
return 0;
}
@@ -32,7 +32,6 @@ enum {
struct DeviceState {
char *id;
enum DevState state;
- QemuOpts *opts;
int hotplugged;
DeviceInfo *info;
BusState *parent_bus;
This was only used because id's memory was stored in opts. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- hw/qdev.c | 5 ++--- hw/qdev.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-)