From patchwork Tue May 26 01:46:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48968 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 47AD72121F for ; Tue, 26 May 2015 01:50:40 +0000 (UTC) Received: by wgla2 with SMTP id a2sf22504522wgl.1 for ; Mon, 25 May 2015 18:50:39 -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=XEUAqxV5ShCEsbLzDameFDg40XcQimWcEOXow+IQfAc=; b=JYyL2JEpm/UDecuEnO2R0NBkxvJ4X9A5F7ciZs3w1lOstrQzmIOdl5qFugYAcriaq3 Sc3Gu70q1/geigjQDKI3O0AEdQ3wtTiOcGr1mLTuik7grohDCxIuAeb1cIznM1qcyGs/ qiNo037alKZkWDqG2VTJnm0nfrHwLyyrYAFLQ33J79liDlAXKKPMbDKeoOxmEsDyIEoU ubQ7aH7uHm3OEshjniDlYT4C+vgXfRaxyGrd5EqxaacTkJuqwiOoODvEO/l9p1AazivR zABQprXQcLTcTy5/PwPvo2ahU9o2Fkq2CFApeqGHH1oHq/k/PPTMhOIQ3RZL3xdLLRcf aJag== X-Gm-Message-State: ALoCoQmn8csdlVpNO7qYWdJicKFCijQhMvl6ALr6MT2CxUYHxcZDdsxU6DlOuBJRrAWeNkKgoCQ6 X-Received: by 10.152.203.233 with SMTP id kt9mr24944072lac.7.1432605039168; Mon, 25 May 2015 18:50:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.225.167 with SMTP id rl7ls823837lac.74.gmail; Mon, 25 May 2015 18:50:39 -0700 (PDT) X-Received: by 10.152.42.230 with SMTP id r6mr2268090lal.30.1432605039055; Mon, 25 May 2015 18:50:39 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id cz4si9695857lac.110.2015.05.25.18.50.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 May 2015 18:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laat2 with SMTP id t2so57821552laa.1 for ; Mon, 25 May 2015 18:50:38 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr20076871lay.72.1432605038931; Mon, 25 May 2015 18:50:38 -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 hn6csp2191191lbb; Mon, 25 May 2015 18:50:37 -0700 (PDT) X-Received: by 10.140.146.129 with SMTP id 123mr32571635qhs.50.1432605037503; Mon, 25 May 2015 18:50:37 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w5si6086561qco.32.2015.05.25.18.50.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 May 2015 18:50:37 -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]:45486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yx40q-0002Jt-Ft for patch@linaro.org; Mon, 25 May 2015 21:50:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yx406-0001LU-HV for qemu-devel@nongnu.org; Mon, 25 May 2015 21:49:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yx405-00035R-Ii for qemu-devel@nongnu.org; Mon, 25 May 2015 21:49:50 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:24348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yx3zz-00033O-RJ; Mon, 25 May 2015 21:49:44 -0400 Received: from 172.24.2.119 (EHLO szxeml427-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BGN88727; Tue, 26 May 2015 09:46:27 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.158.1; Tue, 26 May 2015 09:46:19 +0800 From: Shannon Zhao To: Date: Tue, 26 May 2015 09:46:06 +0800 Message-ID: <1432604767-5964-3-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432604767-5964-1-git-send-email-zhaoshenglong@huawei.com> References: <1432604767-5964-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.5563D074.0022, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d9ddba2d79076a320c6a8cd337175c38 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: qemu-trivial@nongnu.org, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v2 2/3] hw/ide/pci: Fix memory leak 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.47 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: ==16447== 16 bytes in 2 blocks are definitely lost in loss record 1,304 of 3,310 ==16447== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==16447== by 0x2E4FD7: malloc_and_trace (vl.c:2546) ==16447== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==16447== by 0x36FB47: qemu_extend_irqs (irq.c:55) ==16447== by 0x36FBD3: qemu_allocate_irqs (irq.c:64) ==16447== by 0x3B4B44: bmdma_init (pci.c:464) ==16447== by 0x3B547B: pci_piix_init_ports (piix.c:144) ==16447== by 0x3B55D2: pci_piix_ide_realize (piix.c:164) ==16447== by 0x3EAEC6: pci_qdev_realize (pci.c:1790) ==16447== by 0x36C685: device_set_realized (qdev.c:1058) ==16447== by 0x47179E: property_set_bool (object.c:1514) ==16447== by 0x470098: object_property_set (object.c:837) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/ide/pci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 1b3d1c1..4b5e32d 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -452,8 +452,6 @@ static const struct IDEDMAOps bmdma_ops = { void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d) { - qemu_irq *irq; - if (bus->dma == &bm->dma) { return; } @@ -461,8 +459,7 @@ void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d) bm->dma.ops = &bmdma_ops; bus->dma = &bm->dma; bm->irq = bus->irq; - irq = qemu_allocate_irqs(bmdma_irq, bm, 1); - bus->irq = *irq; + bus->irq = qemu_allocate_irq(bmdma_irq, bm, 0); bm->pci_dev = d; }