From patchwork Thu May 28 12:08:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49088 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 7C8DB218EC for ; Thu, 28 May 2015 12:26:48 +0000 (UTC) Received: by wgv5 with SMTP id 5sf5472946wgv.0 for ; Thu, 28 May 2015 05:26:47 -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=XpwSSSM182cOEj28BGWpFqd8ZFD4xvn1TVFLy3JNAIs=; b=bsnz+jrBQL9po/pjGgnWtaHyjLeAc+2pI3Qvtq0qmUB95JBveQhJvGcTl89rsRPSZr LBtYJQEUNuAojRYv0l5+vLyVwKIXOHE3BO5UQ/3bI/FaMFjm7JZyV/6WAkz9P01SWNGk 7ZFoVjEqB96aEF7GoAaHNVIj0xkYotM7u3CORQytPurSQ6gksZMjn+cD4FvwW7okk4xn km9mgDh/Jje3FI8WOI/nGDO9GlWVryn8PB2AzAc/e1Z3vLNuwRS0QdL30yeK7eKm5iQO TgoiZmY1QUO94eWj68pZYXc0vveXCGVqy0DRLDg+pdqcT2HSLbZHHcrli7RfDIA9yilr a3WA== X-Gm-Message-State: ALoCoQlgAcn8p2DvAoA5/YUB0Bg9xdxIamuJGe8aoIORYGg7cA0qTmZT0UoneZzfL7MvCj1CUTsc X-Received: by 10.112.42.236 with SMTP id r12mr2517112lbl.2.1432816007095; Thu, 28 May 2015 05:26:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.9 with SMTP id ky9ls155765lab.98.gmail; Thu, 28 May 2015 05:26:47 -0700 (PDT) X-Received: by 10.152.197.2 with SMTP id iq2mr2510645lac.103.1432816006969; Thu, 28 May 2015 05:26:46 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id w12si1799279lbf.159.2015.05.28.05.26.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 05:26:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labpy14 with SMTP id py14so18535932lab.0 for ; Thu, 28 May 2015 05:26:46 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr2477264lbb.112.1432816006523; Thu, 28 May 2015 05:26:46 -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 hn6csp1116974lbb; Thu, 28 May 2015 05:26:45 -0700 (PDT) X-Received: by 10.55.25.145 with SMTP id 17mr4618108qkz.46.1432816005125; Thu, 28 May 2015 05:26:45 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j81si2188359qkh.72.2015.05.28.05.26.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 May 2015 05:26:45 -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]:58471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwtY-0007Fe-3o for patch@linaro.org; Thu, 28 May 2015 08:26:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxwg3-0005fC-6q for qemu-devel@nongnu.org; Thu, 28 May 2015 08:12:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yxwfz-0004Wq-BQ for qemu-devel@nongnu.org; Thu, 28 May 2015 08:12:47 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:42880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yxwfy-0004WW-LK; Thu, 28 May 2015 08:12:43 -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 CMA92695; Thu, 28 May 2015 20:12:35 +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:24 +0800 From: Shannon Zhao To: Date: Thu, 28 May 2015 20:08:52 +0800 Message-ID: <1432814932-12608-30-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 29/29] hw/s390x/sclpcpu.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.49 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: ==1413== 188 (8 direct, 180 indirect) bytes in 1 blocks are definitely lost in loss record 951 of 1,199 ==1413== at 0x4C2845D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==1413== by 0x262D8B: malloc_and_trace (vl.c:2556) ==1413== by 0x64C770E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) ==1413== by 0x2C7ACF: qemu_extend_irqs (irq.c:55) ==1413== by 0x2C7B5B: qemu_allocate_irqs (irq.c:64) ==1413== by 0x2168F4: irq_cpu_hotplug_init (sclpcpu.c:84) ==1413== by 0x21623F: event_realize (event-facility.c:385) ==1413== by 0x2C4610: device_set_realized (qdev.c:1058) ==1413== by 0x317DDA: property_set_bool (object.c:1514) ==1413== by 0x3166D4: object_property_set (object.c:837) ==1413== by 0x3189F6: object_property_set_qobject (qom-qobject.c:24) ==1413== by 0x316943: object_property_set_bool (object.c:905) Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/s390x/sclpcpu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/s390x/sclpcpu.c b/hw/s390x/sclpcpu.c index 2fe8b5a..1090e2f 100644 --- a/hw/s390x/sclpcpu.c +++ b/hw/s390x/sclpcpu.c @@ -25,13 +25,13 @@ typedef struct ConfigMgtData { uint8_t event_qualifier; } QEMU_PACKED ConfigMgtData; -static qemu_irq *irq_cpu_hotplug; /* Only used in this file */ +static qemu_irq irq_cpu_hotplug; /* Only used in this file */ #define EVENT_QUAL_CPU_CHANGE 1 void raise_irq_cpu_hotplug(void) { - qemu_irq_raise(*irq_cpu_hotplug); + qemu_irq_raise(irq_cpu_hotplug); } static unsigned int send_mask(void) @@ -81,7 +81,10 @@ static void trigger_signal(void *opaque, int n, int level) static int irq_cpu_hotplug_init(SCLPEvent *event) { - irq_cpu_hotplug = qemu_allocate_irqs(trigger_signal, event, 1); + qemu_irq irq = qemu_allocate_irq(trigger_signal, event, 0); + + irq_cpu_hotplug = irq; + qemu_free_irq(irq); return 0; }