From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOTrC-0001lI-UX for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:17:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOTqx-0004st-Bl for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:17:10 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:58295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOTqx-0004sL-0U for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:16:55 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Mar 2014 15:16:54 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id BF9002190046 for ; Fri, 14 Mar 2014 15:16:46 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s2EFGd5i65536004 for ; Fri, 14 Mar 2014 15:16:39 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s2EFGo1G022314 for ; Fri, 14 Mar 2014 09:16:50 -0600 From: Christian Borntraeger Date: Fri, 14 Mar 2014 16:17:10 +0100 Message-Id: <1394810232-9079-3-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1394810232-9079-1-git-send-email-borntraeger@de.ibm.com> References: <1394810232-9079-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH 2/4] s390x/cpu hotplug: Fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Cornelia Huck , Christian Borntraeger , Jens Freimann , Alexander Graf , Richard Henderson valgrind complains about the following: ==42117== 8 bytes in 1 blocks are definitely lost in loss record 88 of 833 ==42117== at 0x4031AFE: malloc (vg_replace_malloc.c:292) ==42117== by 0x8022F855: malloc_and_trace (vl.c:2715) ==42117== by 0x4145569: g_malloc (in /usr/lib64/libglib-2.0.so.0.3400.2) ==42117== by 0x800F696D: qemu_extend_irqs (irq.c:51) ==42117== by 0x800F6AF7: qemu_allocate_irqs (irq.c:68) ==42117== by 0x8029FA4B: irq_cpu_hotplug_init (sclpcpu.c:84) ==42117== by 0x80297C79: event_realize (event-facility.c:386) ==42117== by 0x80105071: device_set_realized (qdev.c:693) [...] Right it is. Don't drop the pointer of the irq. Signed-off-by: Christian Borntraeger Reviewed-by: Jason J. Herne --- hw/s390x/sclpcpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/s390x/sclpcpu.c b/hw/s390x/sclpcpu.c index b9c238a..3600fe2 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,7 @@ 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); + irq_cpu_hotplug = qemu_allocate_irqs(trigger_signal, event, 1); return 0; } -- 1.8.4.2