From patchwork Thu May 28 12:08:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49082 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 95287218EC for ; Thu, 28 May 2015 12:22:26 +0000 (UTC) Received: by wixv7 with SMTP id v7sf13370390wix.0 for ; Thu, 28 May 2015 05:22:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=kJv+7H3d9W9uIzRvkA+xhJK5FT1OyN8hOXFXL+sKiMw=; b=XBaDegv41nlW2Y7lymuGs4Uy1IgancUn+IpuSp/4/7KkSWXdyrafRlXIWmzNZ7tug5 /vkqazd8uIzbAFNcJ7+TKRLAn5InGYu/nNe4bmzDIbNkwI/vsfZ/n3tRxRBwZAXMAnc9 OWSJTmPa/1WGaiiR8X7klF9ebsk6L9TBlkqiEYjRsB3/7kLJq2bg7crZaRJBTxN25D77 rXeS9XnS30Hklg67Xtq6S1FO2BDbfwejfoOFWzj3JgmLp91JuBYKscdjI/pVjFbH4EoI RMLxGRsuCvJnkGikPo1HgtC5B7g9oAUZTRAgF0kv2P+kub8k0IJDNz9dmynfJnWaJytY nPFw== X-Gm-Message-State: ALoCoQl8MX/SU62TDxeXklGHkUcLfTVPpHa8u//lPahC/UuC4hgmDFuO5kvABeYx+IsgWZWmTCSQ X-Received: by 10.180.89.231 with SMTP id br7mr7597305wib.0.1432815745579; Thu, 28 May 2015 05:22:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.74 with SMTP id k10ls186720laf.30.gmail; Thu, 28 May 2015 05:22:25 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr2458084lak.29.1432815745193; Thu, 28 May 2015 05:22:25 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id wc1si1822321lbb.66.2015.05.28.05.22.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 05:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labko7 with SMTP id ko7so26581354lab.2 for ; Thu, 28 May 2015 05:22:24 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr2540062laa.106.1432815744930; Thu, 28 May 2015 05:22:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1113922lbb; Thu, 28 May 2015 05:22:24 -0700 (PDT) X-Received: by 10.55.51.210 with SMTP id z201mr4501813qkz.35.1432815743570; Thu, 28 May 2015 05:22:23 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j81si2177480qkh.72.2015.05.28.05.22.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 05:22:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:58413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwpK-00060P-JW for patch@linaro.org; Thu, 28 May 2015 08:22:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwfQ-0004TM-Vc for qemu-devel@nongnu.org; Thu, 28 May 2015 08:12:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxwfM-0004MN-Vv for qemu-devel@nongnu.org; Thu, 28 May 2015 08:12:08 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:42478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwfM-0004KP-EF; Thu, 28 May 2015 08:12:04 -0400 Received: from 172.24.2.119 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CMA92611; Thu, 28 May 2015 20:11:52 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.158.1; Thu, 28 May 2015 20:10:14 +0800 From: Shannon Zhao To: Date: Thu, 28 May 2015 20:08:44 +0800 Message-ID: <1432814932-12608-22-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432814932-12608-1-git-send-email-zhaoshenglong@huawei.com> References: <1432814932-12608-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, mjt@tls.msk.ru, shannon.zhao@linaro.org, peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH 21/29] hw/sh4/r2d.c: Fix memory leak spotted by valgrind X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao valgrind complains about: ==29844== 1,364 (104 direct, 1,260 indirect) bytes in 1 blocks are definitely lost in loss record 2,143 of 2,205 ==29844== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==29844== by 0x25096F: malloc_and_trace (vl.c:2556) ==29844== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==29844== by 0x2C7CDB: qemu_extend_irqs (irq.c:55) ==29844== by 0x2C7D67: qemu_allocate_irqs (irq.c:64) ==29844== by 0x2167ED: r2d_fpga_init (r2d.c:191) ==29844== by 0x2169CC: r2d_init (r2d.c:263) ==29844== by 0x254D3A: main (vl.c:4249) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/sh4/r2d.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 4221060..594c733 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -287,6 +287,16 @@ static void r2d_init(MachineState *machine) sysbus_mmio_map(busdev, 1, 0x1400080c); mmio_ide_init_drives(dev, dinfo, NULL); + /* free unused irq */ + qemu_free_irq(irq[CF_CD]); + qemu_free_irq(irq[KEY]); + qemu_free_irq(irq[RTC_A]); + qemu_free_irq(irq[RTC_T]); + qemu_free_irq(irq[SDCARD]); + qemu_free_irq(irq[EXT]); + qemu_free_irq(irq[TP]); + g_free(irq); + /* onboard flash memory */ dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, NULL, "r2d.flash", FLASH_SIZE,