From patchwork Mon May 25 08:37:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48954 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 253662121F for ; Mon, 25 May 2015 08:42:32 +0000 (UTC) Received: by wgwl7 with SMTP id l7sf20473915wgw.0 for ; Mon, 25 May 2015 01:42:31 -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=R5OIurW+vzytcc11mZibX1DvSkD7FWg5CQKK+vIv5VM=; b=JS5NzdmGBrt11jPjC7/fkYYmYKhsiuUPZcqfKq9EC8E/akD2UBJRRR+db3tv5nr8Bw 4hglW1zYynK155/cpiGEnPTyHprriVJ6TsTvmFai2D5XRNWsslyK33IAMGWM9rN9D6pz Vfp4VsMzK57IO0qlvixC1M89bhECr7Kd1KWKTGUTF3O5ieqmcwmfqo5jKNCKP/1/JwGx rmDd/JTHVFmZToNvc95PeIA3PLzNy6XS4uCbAU8thcx8+DjWWAyk6O65gAVnVQbCdjzV fqw5ITY+it/d7lLar3RbzEMVJ1RLvDP7wCcbstZb4zB01au56fr8j5+b01s3GF4e3lr1 m3xw== X-Gm-Message-State: ALoCoQn+buUo50MhXgfJwsu4mx5EsxM1QvgcsuF2BGNqN/7/2EVKIo41dKdpv/4H1mMs2tHA3NS3 X-Received: by 10.180.11.101 with SMTP id p5mr17548573wib.3.1432543343898; Mon, 25 May 2015 01:42:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.229 with SMTP id w5ls710807lag.44.gmail; Mon, 25 May 2015 01:42:23 -0700 (PDT) X-Received: by 10.152.19.8 with SMTP id a8mr17348506lae.121.1432543343658; Mon, 25 May 2015 01:42:23 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id o5si7830181lae.1.2015.05.25.01.42.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 May 2015 01:42:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lami4 with SMTP id i4so45457984lam.0 for ; Mon, 25 May 2015 01:42:23 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr17410435lae.19.1432543343536; Mon, 25 May 2015 01:42:23 -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 hn6csp1694419lbb; Mon, 25 May 2015 01:42:22 -0700 (PDT) X-Received: by 10.55.26.165 with SMTP id l37mr7949170qkh.88.1432543342189; Mon, 25 May 2015 01:42:22 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d33si6023723qge.52.2015.05.25.01.42.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 May 2015 01:42:22 -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]:42502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ywnxl-0005Tv-Dn for patch@linaro.org; Mon, 25 May 2015 04:42:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ywnvo-0002Pv-Ai for qemu-devel@nongnu.org; Mon, 25 May 2015 04:40:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ywnvk-0001Hw-Ji for qemu-devel@nongnu.org; Mon, 25 May 2015 04:40:20 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:22106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ywnvc-00016D-C2; Mon, 25 May 2015 04:40:08 -0400 Received: from 172.24.2.119 (EHLO szxeml427-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CLV99027; Mon, 25 May 2015 16:39:57 +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; Mon, 25 May 2015 16:38:07 +0800 From: Shannon Zhao To: Date: Mon, 25 May 2015 16:37:55 +0800 Message-ID: <1432543077-12656-2-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432543077-12656-1-git-send-email-zhaoshenglong@huawei.com> References: <1432543077-12656-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, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH 1/3] hw/i386/pc_piix: 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.53 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== 8 bytes in 1 blocks are definitely lost in loss record 552 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 0x24E622: pc_init1 (pc_piix.c:287) ==16447== by 0x24E76A: pc_init_pci (pc_piix.c:310) ==16447== by 0x2E9360: main (vl.c:4226) ==16447== 128 bytes in 1 blocks are definitely lost in loss record 2,569 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 0x25BEB2: kvm_i8259_init (i8259.c:133) ==16447== by 0x24E1F1: pc_init1 (pc_piix.c:219) ==16447== by 0x24E76A: pc_init_pci (pc_piix.c:310) ==16447== by 0x2E9360: main (vl.c:4226) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/i386/pc_piix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1fe7bfb..49d87ee 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -227,6 +227,7 @@ static void pc_init1(MachineState *machine, for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } + g_free(i8259); if (pci_enabled) { ioapic_init_gsi(gsi_state, "i440fx"); } @@ -289,6 +290,7 @@ static void pc_init1(MachineState *machine, smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, gsi[9], *smi_irq, kvm_enabled(), fw_cfg, &piix4_pm); + g_free(smi_irq); smbus_eeprom_init(smbus, 8, NULL, 0); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,