summaryrefslogtreecommitdiffstats
path: root/hw/sd
diff options
context:
space:
mode:
authorMarc-André Lureau2016-07-14 18:03:49 +0200
committerMarc-André Lureau2016-09-08 16:05:22 +0200
commit5ba344013c2def84483f83881a631fb18f14ed42 (patch)
treebcca2d9ebd7b375dec0c4a603c2fa4cf9ff64266 /hw/sd
parentpc: keep gsi reference (diff)
downloadqemu-5ba344013c2def84483f83881a631fb18f14ed42.tar.gz
qemu-5ba344013c2def84483f83881a631fb18f14ed42.tar.xz
qemu-5ba344013c2def84483f83881a631fb18f14ed42.zip
sd: free timer
Free the timer allocated in instance_init. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Diffstat (limited to 'hw/sd')
-rw-r--r--hw/sd/sd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 87c6dc108d..8e88e8311a 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1876,6 +1876,14 @@ static void sd_instance_init(Object *obj)
sd->ocr_power_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sd_ocr_powerup, sd);
}
+static void sd_instance_finalize(Object *obj)
+{
+ SDState *sd = SD_CARD(obj);
+
+ timer_del(sd->ocr_power_timer);
+ timer_free(sd->ocr_power_timer);
+}
+
static void sd_realize(DeviceState *dev, Error **errp)
{
SDState *sd = SD_CARD(dev);
@@ -1927,6 +1935,7 @@ static const TypeInfo sd_info = {
.class_size = sizeof(SDCardClass),
.class_init = sd_class_init,
.instance_init = sd_instance_init,
+ .instance_finalize = sd_instance_finalize,
};
static void sd_register_types(void)