Received: from eggs.gnu.org ([2001:4830:134:3::10]:57542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi0A1-0001aw-5Z for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:18:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi09w-0000kA-1Y for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:18:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi09v-0000k4-Rz for qemu-devel@nongnu.org; Thu, 08 Sep 2016 10:18:31 -0400 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 8 Sep 2016 18:17:14 +0400 Message-Id: <20160908141720.30641-20-marcandre.lureau@redhat.com> In-Reply-To: <20160908141720.30641-1-marcandre.lureau@redhat.com> References: <20160908141720.30641-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULLv2 19/25] sd: free timer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Free the timer allocated in instance_init. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Andrew Baumann --- hw/sd/sd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 87c6dc1..8e88e83 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 =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, sd_ocr_powe= rup, sd); } =20 +static void sd_instance_finalize(Object *obj) +{ + SDState *sd =3D 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 =3D SD_CARD(dev); @@ -1927,6 +1935,7 @@ static const TypeInfo sd_info =3D { .class_size =3D sizeof(SDCardClass), .class_init =3D sd_class_init, .instance_init =3D sd_instance_init, + .instance_finalize =3D sd_instance_finalize, }; =20 static void sd_register_types(void) --=20 2.10.0