From patchwork Thu May 28 12:08:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49089 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 75FDF218EC for ; Thu, 28 May 2015 12:27:37 +0000 (UTC) Received: by lbcak1 with SMTP id ak1sf10144139lbc.2 for ; Thu, 28 May 2015 05:27:36 -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=rvUlj6EYFjg4lCs+LybnA3+5/okA4zqFfV7wHrpyXrA=; b=M4R8WIx6dAyFEQiaaIh/twuB7UhSlN5THwvmn6VwkHwxMH823GGYiHcieqLgF/Lt9X nS/l7QHVeoGqc04FGtJ7BQXQab1FUUBy7s1zG72zde7KUd+oN5SqDAtHAbpc3y57TG7N RsopksDWoBxyEmnGGpYfsUD6evg9XzphJbfUaohu3Eo3f9dAKGbu3MWOFHWcRV9KEU84 WPe0thvdTnYzL+s5pD9IgrzA0zy7rAcVym1f7ni57z+BvzvgHM7NWQWc4OrcGglzNkw2 V2v3zVAA3DzTVQkYDPAFAvE4MFV0qePHqsvhQ7J103o3NC661++4SbFHz1aeSICxaDD/ 2OoA== X-Gm-Message-State: ALoCoQlX6WSGqxucN0BzWx2cJw7BGzdoAzsTtMMfqQDjXqrc7XovEnGVXd9KLBFs0eWHiD0X56BX X-Received: by 10.152.203.233 with SMTP id kt9mr2474379lac.7.1432816056445; Thu, 28 May 2015 05:27:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.10 with SMTP id z10ls185922lae.24.gmail; Thu, 28 May 2015 05:27:36 -0700 (PDT) X-Received: by 10.112.158.103 with SMTP id wt7mr2505903lbb.5.1432816056323; Thu, 28 May 2015 05:27:36 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id g1si1842164lbs.32.2015.05.28.05.27.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 05:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by laat2 with SMTP id t2so30355483laa.1 for ; Thu, 28 May 2015 05:27:36 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr2476186lak.29.1432816056235; Thu, 28 May 2015 05:27:36 -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 hn6csp1117594lbb; Thu, 28 May 2015 05:27:35 -0700 (PDT) X-Received: by 10.140.90.99 with SMTP id w90mr2689115qgd.57.1432816054831; Thu, 28 May 2015 05:27:34 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w77si2210397qgw.25.2015.05.28.05.27.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 05:27:34 -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]:58481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwuL-0000QU-Lv for patch@linaro.org; Thu, 28 May 2015 08:27:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxweB-0002I8-Of for qemu-devel@nongnu.org; Thu, 28 May 2015 08:10:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yxwe6-0003dC-Ud for qemu-devel@nongnu.org; Thu, 28 May 2015 08:10:51 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:45300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxwe5-0003b9-UN; Thu, 28 May 2015 08:10:46 -0400 Received: from 172.24.2.119 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id COP98116; Thu, 28 May 2015 20:10:34 +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:15 +0800 From: Shannon Zhao To: Date: Thu, 28 May 2015 20:08:45 +0800 Message-ID: <1432814932-12608-23-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: 58.251.152.64 Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, mjt@tls.msk.ru, shannon.zhao@linaro.org, peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH 22/29] hw/alpha/typhoon.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.54 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: ==7055== 8 bytes in 1 blocks are definitely lost in loss record 403 of 2,192 ==7055== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7055== by 0x24410F: malloc_and_trace (vl.c:2556) ==7055== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==7055== by 0x2B7A8B: qemu_extend_irqs (irq.c:55) ==7055== by 0x2B7B17: qemu_allocate_irqs (irq.c:64) ==7055== by 0x2197CB: typhoon_init (typhoon.c:844) ==7055== by 0x2178FD: clipper_init (dp264.c:73) ==7055== by 0x2484DA: main (vl.c:4249) ==7055== ==7055== 8 bytes in 1 blocks are definitely lost in loss record 404 of 2,192 ==7055== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7055== by 0x24410F: malloc_and_trace (vl.c:2556) ==7055== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==7055== by 0x2B7A8B: qemu_extend_irqs (irq.c:55) ==7055== by 0x2B7B17: qemu_allocate_irqs (irq.c:64) ==7055== by 0x219BA7: typhoon_init (typhoon.c:924) ==7055== by 0x2178FD: clipper_init (dp264.c:73) ==7055== by 0x2484DA: main (vl.c:4249) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/alpha/typhoon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index 7df842d..3bb6d3d 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -841,7 +841,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, } } - *p_rtc_irq = *qemu_allocate_irqs(typhoon_set_timer_irq, s, 1); + *p_rtc_irq = qemu_allocate_irq(typhoon_set_timer_irq, s, 0); /* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ @@ -921,7 +921,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, qemu_irq isa_pci_irq, *isa_irqs; *isa_bus = isa_bus_new(NULL, get_system_memory(), &s->pchip.reg_io); - isa_pci_irq = *qemu_allocate_irqs(typhoon_set_isa_irq, s, 1); + isa_pci_irq = qemu_allocate_irq(typhoon_set_isa_irq, s, 0); isa_irqs = i8259_init(*isa_bus, isa_pci_irq); isa_bus_irqs(*isa_bus, isa_irqs); }