From d21357df9a2a6b7e6bb2f579d04877f3bd65c557 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 1 Jun 2010 20:32:31 +0200 Subject: qdev: Don't leak string property value on hot unplug parse_string() qemu_strdup()s the property value. It is never freed. It needs to be freed along with the device. Otherwise, the value of scsi-disk property "ver" gets leaked when hot-unplugging the disk, for instance. Call new PropertyInfo method free() from qdev_free(). Implement it for qdev_prop_string. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- hw/qdev.h | 1 + 1 file changed, 1 insertion(+) (limited to 'hw/qdev.h') diff --git a/hw/qdev.h b/hw/qdev.h index 7c25a94..51a24e2 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -98,6 +98,7 @@ struct PropertyInfo { enum PropertyType type; int (*parse)(DeviceState *dev, Property *prop, const char *str); int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); + void (*free)(DeviceState *dev, Property *prop); }; typedef struct GlobalProperty { -- cgit v1.1