From patchwork Wed Jun 3 13:08:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 49457 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 AB1D020BE7 for ; Wed, 3 Jun 2015 13:10:09 +0000 (UTC) Received: by wibbk2 with SMTP id bk2sf5193888wib.2 for ; Wed, 03 Jun 2015 06:10:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references: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=AvZT7B8Gr5rU7gnFjdNWZsDVO2XuONbT4qBtdatMsFY=; b=FKs0KLjMupE4jCu7qmAW8zmzL+piX/mESkDpwunM7qcx68UeJD+i1/jJemnVWqGstK +KYnytmAPaTdKjnBwjEo12WtEhlrzsohTl+zXG5IS6EVHNKI/aM/J6HKv4+ezTmxxHS7 Y025Rvr1NVP/EGRZ369v6KXDt7OTBZTLnesHJZbA63GOMZoWXgB107wesQazr52YilBp rv2R26kf6pibpYq7mc/yTQ4f9O1U5l508pIcjVVXe1fxS17xyNLmo0TFO3k4dzaFeOMg JruR2Pp3x3Zcxn5raSGCc76E43k8TDTbMhlCObZ2I9tyZNhUzxY9aYszm40lfKy38+cn Bfuw== X-Gm-Message-State: ALoCoQnQlJI8xoWyiy0sewyLwS9y1YP7SclzAeVfBXqhfKFdO+bLmsArsXjjZMYzdhRfRc3R3xtX X-Received: by 10.180.106.10 with SMTP id gq10mr21396414wib.0.1433337009000; Wed, 03 Jun 2015 06:10:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.2 with SMTP id bc2ls58761lab.101.gmail; Wed, 03 Jun 2015 06:10:08 -0700 (PDT) X-Received: by 10.152.23.38 with SMTP id j6mr8985021laf.47.1433337008807; Wed, 03 Jun 2015 06:10:08 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id lr9si7590030lbb.64.2015.06.03.06.10.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jun 2015 06:10:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbcue7 with SMTP id ue7so6574762lbc.0 for ; Wed, 03 Jun 2015 06:10:08 -0700 (PDT) X-Received: by 10.112.234.200 with SMTP id ug8mr31397275lbc.117.1433337008690; Wed, 03 Jun 2015 06:10:08 -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 hn6csp3856648lbb; Wed, 3 Jun 2015 06:10:07 -0700 (PDT) X-Received: by 10.55.33.23 with SMTP id h23mr22462396qkh.61.1433337006593; Wed, 03 Jun 2015 06:10:06 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h65si528430qkh.65.2015.06.03.06.10.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Jun 2015 06:10:06 -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]:35393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z08Qn-0000n4-D7 for patch@linaro.org; Wed, 03 Jun 2015 09:10:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z08Pi-0007xx-Jb for qemu-devel@nongnu.org; Wed, 03 Jun 2015 09:09:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z08Pd-0004uz-Kp for qemu-devel@nongnu.org; Wed, 03 Jun 2015 09:08:58 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:45301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z08Pd-0004u9-Dz; Wed, 03 Jun 2015 09:08:53 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 635744079A; Wed, 3 Jun 2015 16:08:52 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id 4941FA51; Wed, 3 Jun 2015 16:08:52 +0300 (MSK) Received: (nullmailer pid 27422 invoked by uid 1000); Wed, 03 Jun 2015 13:08:52 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Wed, 3 Jun 2015 16:08:25 +0300 Message-Id: <2ba154cf4eb8636cdd3aa90f392ca9e77206ca39.1433336870.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Michael Tokarev , Shannon Zhao , Shannon Zhao Subject: [Qemu-devel] [PULL 05/30] 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: mjt@tls.msk.ru X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 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 Reviewed-by: Marcel Apfelbaum Signed-off-by: Michael Tokarev --- hw/i386/pc_piix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6e7fa42..8d949a3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -89,7 +89,7 @@ static void pc_init1(MachineState *machine) qemu_irq *cpu_irq; qemu_irq *gsi; qemu_irq *i8259; - qemu_irq *smi_irq; + qemu_irq smi_irq; GSIState *gsi_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BusState *idebus[MAX_IDE_BUS]; @@ -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"); } @@ -284,10 +285,10 @@ static void pc_init1(MachineState *machine) DeviceState *piix4_pm; I2CBus *smbus; - smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); + smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); /* TODO: Populate SPD eeprom data. */ smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, - gsi[9], *smi_irq, + gsi[9], smi_irq, kvm_enabled(), fw_cfg, &piix4_pm); smbus_eeprom_init(smbus, 8, NULL, 0);