From patchwork Thu May 28 12:08:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49085 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A083218EC for ; Thu, 28 May 2015 12:24:34 +0000 (UTC) Received: by laat2 with SMTP id t2sf10657433laa.2 for ; Thu, 28 May 2015 05:24:33 -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=2PMl5bPmKXDL4nq1z7DMhS4k8rKswVZB/vB3R/HsxWM=; b=LxgwyhWNgKTMEYlFj0D/JpSgHjiu2MtygnD/WSw9N6WcXRVFZzqmr9tM/IpG9CwJpy rokVdfFzZ1eg3D3Pcv61ltTEVuph4SxDnN5WOIvifTBE4QoeHFYLNNroSiSleqtXzEea GnTCCVN/jZVfWSm3Jxjb9FvLhSNo/nEcnnNro1b+TffxaJCtOhmrFi0mcYP1b8vKVncx 99vbkwTwJCxogdiAjpNY8wkB3i3H7G2s1jkPThPIndRLBV/VtKckMHXA+CmT8etnTL7s ZZVAWx55lFSXfAWV3v11htXYuTrvlT+C2dDlenNCb1+IQfGcF94F4Qn4bZOCjHbJwx+n 6U/w== X-Gm-Message-State: ALoCoQm6B9Xs0LEg41YN+0yRfE6kGCVbgzBUzfX63vmKOoP1fVY1p59CGXsPQLabVoOFaLg1v+qo X-Received: by 10.112.13.200 with SMTP id j8mr2443993lbc.14.1432815872655; Thu, 28 May 2015 05:24:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.67 with SMTP id da3ls211291lad.49.gmail; Thu, 28 May 2015 05:24:32 -0700 (PDT) X-Received: by 10.152.8.102 with SMTP id q6mr2462846laa.27.1432815872540; Thu, 28 May 2015 05:24:32 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id ao2si1797271lac.169.2015.05.28.05.24.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 05:24:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbbuc2 with SMTP id uc2so26993570lbb.2 for ; Thu, 28 May 2015 05:24:32 -0700 (PDT) X-Received: by 10.112.182.4 with SMTP id ea4mr2553435lbc.35.1432815872446; Thu, 28 May 2015 05:24:32 -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 hn6csp1115408lbb; Thu, 28 May 2015 05:24:31 -0700 (PDT) X-Received: by 10.140.96.43 with SMTP id j40mr2719475qge.22.1432815871049; Thu, 28 May 2015 05:24:31 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s68si2179064qgs.69.2015.05.28.05.24.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 05:24:31 -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]:58444 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwrN-0002MV-V2 for patch@linaro.org; Thu, 28 May 2015 08:24:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwfQ-0004Sh-LP 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-0004M4-Tf for qemu-devel@nongnu.org; Thu, 28 May 2015 08:12:08 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:42476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwfM-0004KL-CL; 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 CMA92613; Thu, 28 May 2015 20:11:53 +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:21 +0800 From: Shannon Zhao To: Date: Thu, 28 May 2015 20:08:49 +0800 Message-ID: <1432814932-12608-27-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 26/29] hw/arm/spitz.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.217.175 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: ==19832== 244 (64 direct, 180 indirect) bytes in 1 blocks are definitely lost in loss record 2,220 of 2,846 ==19832== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==19832== by 0x35479F: malloc_and_trace (vl.c:2556) ==19832== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==19832== by 0x3ED99B: qemu_extend_irqs (irq.c:55) ==19832== by 0x3EDA27: qemu_allocate_irqs (irq.c:64) ==19832== by 0x2875CF: spitz_scoop_gpio_setup (spitz.c:818) ==19832== by 0x2879FE: spitz_common_init (spitz.c:931) ==19832== by 0x287AEF: spitz_init (spitz.c:957) ==19832== by 0x358B6A: main (vl.c:4249) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/arm/spitz.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 5bf032a..6ff1825 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -815,7 +815,7 @@ static void spitz_out_switch(void *opaque, int line, int level) static void spitz_scoop_gpio_setup(PXA2xxState *cpu, DeviceState *scp0, DeviceState *scp1) { - qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, cpu, 8); + qemu_irq *outsignals = qemu_allocate_irqs(spitz_out_switch, cpu, 7); qdev_connect_gpio_out(scp0, SPITZ_SCP_CHRG_ON, outsignals[0]); qdev_connect_gpio_out(scp0, SPITZ_SCP_JK_B, outsignals[1]); @@ -825,9 +825,13 @@ static void spitz_scoop_gpio_setup(PXA2xxState *cpu, if (scp1) { qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_CONT, outsignals[4]); qdev_connect_gpio_out(scp1, SPITZ_SCP2_BACKLIGHT_ON, outsignals[5]); + } else { + qemu_free_irq(outsignals[4]); + qemu_free_irq(outsignals[5]); } qdev_connect_gpio_out(scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]); + g_free(outsignals); } #define SPITZ_GPIO_HSYNC 22