From nobody Fri Dec 19 15:54:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1583426014; cv=none; d=zohomail.com; s=zohoarc; b=fRjXIPcJIYiFRGkwxKjVxNdgs6aOn1MOtV2WoY5JOpPaB40ruI8D4suisSvswLlNrWLxfmmDb4jcmzVUpbd344tuaY+E2aUWgxBcxv5YAvvCGylNclDT3Fw4mn5qpxGJQL8VXzAhB6bWQ3Lq/DGKAlMyNWrBNPDmmSk4GT17riM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583426014; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GAoBKDlZfxCwYkYrGHnP4g29Dujg66/yINbEGmDpBFY=; b=bpam4i4M4wo39HDfI7es+/CJlbHkXMyNdEupnETOp/ZE+0CbvyE2k0ZC7jMKG8Vp50HLX3YGdMnrt1l8+Y16qMC93w3iQjUtn8Z9Uu96t9W1vEDxGyC/OtGZkFhuvdz5qWwUA1RhopWX9MvEFhw2rxjfscMwlRnR1QSPuEMS898= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583426014765311.914278507335; Thu, 5 Mar 2020 08:33:34 -0800 (PST) Received: from localhost ([::1]:52430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9tRF-0005s9-MN for importer@patchew.org; Thu, 05 Mar 2020 11:33:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59177) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9tP4-0003QE-KB for qemu-devel@nongnu.org; Thu, 05 Mar 2020 11:31:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9tP2-0002ER-O5 for qemu-devel@nongnu.org; Thu, 05 Mar 2020 11:31:18 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:53657) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9tP2-0002Cz-Gm for qemu-devel@nongnu.org; Thu, 05 Mar 2020 11:31:16 -0500 Received: by mail-wm1-x329.google.com with SMTP id g134so7043542wme.3 for ; Thu, 05 Mar 2020 08:31:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w22sm10310729wmk.34.2020.03.05.08.31.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 08:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GAoBKDlZfxCwYkYrGHnP4g29Dujg66/yINbEGmDpBFY=; b=SbMhz/LzQEGinciFRS2RibMCmnMpc4yM1hwoVDo43pfN81w9hLjnpkeUNxReEo9Ak7 AT4TW8z6bPKTjTNva0zP+rrfnocyj0B7fH6Qq+NHm6qoobl1xpd0U8KphzZZWSFeHacs 6OQxYtfKzjhLMvBkkrbWAv16iD7I6i+nmlZzrslAZ1BtbbnSDI7TEIsO3nRksMjeFai7 WJs4IFxcj4bTtevlli84HopAojPbCj9rtGtm09QfUmqI9raZXxFtJFdUMznQS7oc2DsN 1H7g9ZUaxEAKUcz6c0OE6d4BZNjS+nn3lW0lN7TzVoSgmwtlfQ+umyIfw3hJful/GW3N Ca6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GAoBKDlZfxCwYkYrGHnP4g29Dujg66/yINbEGmDpBFY=; b=iltEX3YABWaJi0p8r3/L4aM0ElTmb5hnQlBUVua+ISS8rEr2VzxdsVgzZXr0O4W3Us H2ORi36yD53vGqHuGW40IMkz6HQ3dz4ght7A8sNgujQpX4lR6mjppsKXCABcKmRJyxzV Euhg65OVkGYX37TRe4T+PwDtccMXfxmqsYAIWVgHBq9HlYyQyZAyQjPPzSaBV1dR+pIc 9iNEBl8SGhMXmjAr/8/fvaLDtMGQrZy7fMqqK5/u7Y39NlWJgCVwwb6MqYOQbGxrQ8Gr JwRqfVp5oHo0D6rIWUNSrUoQ1Tl0P9DX0XUIwsECvhHiM+v2GD8FA9UJ11o4cJGo/BED TKWg== X-Gm-Message-State: ANhLgQ0N00lHTjiMGP+Xayy7wt/m/7VPgfLmpXEeWeMGL8VZqCQDcOm3 HvSlECW+c0FdCCA2bSU5Vyah3tJMgYUMNQ== X-Google-Smtp-Source: ADFU+vtgKIc5ohNp4lmALMiD1zOHW42Ht0TolAghhv1943wqZZ+uj3jwKDMIJsBRyvRrOH9z4Phg1Q== X-Received: by 2002:a1c:a1c2:: with SMTP id k185mr1541615wme.164.1583425874807; Thu, 05 Mar 2020 08:31:14 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/37] hw/arm/pxa2xx: move timer_new from init() into realize() to avoid memleaks Date: Thu, 5 Mar 2020 16:30:34 +0000 Message-Id: <20200305163100.22912-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200305163100.22912-1-peter.maydell@linaro.org> References: <20200305163100.22912-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan There are some memleaks when we call 'device_list_properties'. This patch m= ove timer_new from init into realize to fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Message-id: 20200227025055.14341-3-pannengyuan@huawei.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/pxa2xx.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index b33f8f1351f..56a36202d71 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -1134,18 +1134,22 @@ static void pxa2xx_rtc_init(Object *obj) s->last_rtcpicr =3D 0; s->last_hz =3D s->last_sw =3D s->last_pi =3D qemu_clock_get_ms(rtc_clo= ck); =20 + sysbus_init_irq(dev, &s->rtc_irq); + + memory_region_init_io(&s->iomem, obj, &pxa2xx_rtc_ops, s, + "pxa2xx-rtc", 0x10000); + sysbus_init_mmio(dev, &s->iomem); +} + +static void pxa2xx_rtc_realize(DeviceState *dev, Error **errp) +{ + PXA2xxRTCState *s =3D PXA2XX_RTC(dev); s->rtc_hz =3D timer_new_ms(rtc_clock, pxa2xx_rtc_hz_tick, s); s->rtc_rdal1 =3D timer_new_ms(rtc_clock, pxa2xx_rtc_rdal1_tick, s); s->rtc_rdal2 =3D timer_new_ms(rtc_clock, pxa2xx_rtc_rdal2_tick, s); s->rtc_swal1 =3D timer_new_ms(rtc_clock, pxa2xx_rtc_swal1_tick, s); s->rtc_swal2 =3D timer_new_ms(rtc_clock, pxa2xx_rtc_swal2_tick, s); s->rtc_pi =3D timer_new_ms(rtc_clock, pxa2xx_rtc_pi_tick, s); - - sysbus_init_irq(dev, &s->rtc_irq); - - memory_region_init_io(&s->iomem, obj, &pxa2xx_rtc_ops, s, - "pxa2xx-rtc", 0x10000); - sysbus_init_mmio(dev, &s->iomem); } =20 static int pxa2xx_rtc_pre_save(void *opaque) @@ -1203,6 +1207,7 @@ static void pxa2xx_rtc_sysbus_class_init(ObjectClass = *klass, void *data) =20 dc->desc =3D "PXA2xx RTC Controller"; dc->vmsd =3D &vmstate_pxa2xx_rtc_regs; + dc->realize =3D pxa2xx_rtc_realize; } =20 static const TypeInfo pxa2xx_rtc_sysbus_info =3D { --=20 2.20.1