aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-25 21:42:49 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:49 -0500
commitef80b466230021da9fe490175cd542a58dcabe94 (patch)
tree1a17d701f6a3734339af97830f4a7e2b196f096e /hw
parent7101174e5cd37ed57fadbba9515f2f3e15aec47d (diff)
store a pointer to QemuOpts in DeviceState, release it when zapping a device.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/qdev.c3
-rw-r--r--hw/qdev.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index ebddcaedbd..3ce69be47e 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -218,6 +218,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
qdev_free(qdev);
return NULL;
}
+ qdev->opts = opts;
return qdev;
}
@@ -276,6 +277,8 @@ void qdev_free(DeviceState *dev)
qemu_unregister_reset(dev->info->reset, dev);
if (dev->info->exit)
dev->info->exit(dev);
+ if (dev->opts)
+ qemu_opts_del(dev->opts);
}
QLIST_REMOVE(dev, sibling);
qemu_free(dev);
diff --git a/hw/qdev.h b/hw/qdev.h
index ca7c21a3bd..7da78378bf 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -29,6 +29,7 @@ enum DevState {
struct DeviceState {
const char *id;
enum DevState state;
+ QemuOpts *opts;
int hotplugged;
DeviceInfo *info;
BusState *parent_bus;