qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org,
	mjt@tls.msk.ru, shannon.zhao@linaro.org
Subject: Re: [Qemu-devel] [PATCH 29/29] hw/s390x/sclpcpu.c: Fix memory leak spotted by valgrind
Date: Sat, 30 May 2015 12:34:31 +0200	[thread overview]
Message-ID: <55699237.7070702@redhat.com> (raw)
In-Reply-To: <1432814932-12608-30-git-send-email-zhaoshenglong@huawei.com>



On 28/05/2015 14:08, Shannon Zhao wrote:
> -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;

This is wrong, you cannot free the IRQ after you have stored it in
irq_cpu_hotplug.

Paolo

  parent reply	other threads:[~2015-05-30 10:34 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 12:08 [Qemu-devel] [PATCH 00/29] Fix memory leak relevant to calling qemu_allocate_irqs Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 01/29] hw/ide/ahci.c: Fix memory leak spotted by valgrind Shannon Zhao
2015-05-28 12:16   ` Peter Maydell
2015-05-28 12:24     ` Shannon Zhao
2015-05-28 12:39       ` Peter Maydell
2015-05-28 12:08 ` [Qemu-devel] [PATCH 02/29] hw/ide/cmd646.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 03/29] hw/i386/pc: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 04/29] hw/i386/pc_q35.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 05/29] hw/isa/lpc_ich9.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 06/29] hw/isa/i82378.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 07/29] hw/timer/arm_timer.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 08/29] hw/intc/exynos4210_gic.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 09/29] hw/sparc/leon3.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 10/29] hw/sparc/sun4m.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 11/29] hw/ppc/mac_oldworld.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 12/29] hw/ppc/ppc440_bamboo.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 13/29] hw/ppc/prep.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 14/29] hw/mips/mips_int.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 15/29] hw/mips/mips_jazz.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 16/29] hw/lm32/lm32_boards.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 17/29] hw/lm32/milkymist.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 18/29] hw/m68k/mcf5206.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 19/29] hw/openrisc/pic_cpu.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 20/29] hw/unicore32/puv3.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 21/29] hw/sh4/r2d.c: " Shannon Zhao
2015-05-28 12:46   ` Peter Maydell
2015-05-29  2:11     ` Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 22/29] hw/alpha/typhoon.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 23/29] hw/arm/nseries.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 24/29] hw/arm/omap_sx1.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 25/29] hw/arm/palm.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 26/29] hw/arm/spitz.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 27/29] hw/arm/tosa.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 28/29] hw/display/tc6393xb.c: " Shannon Zhao
2015-05-28 12:08 ` [Qemu-devel] [PATCH 29/29] hw/s390x/sclpcpu.c: " Shannon Zhao
2015-05-28 13:11   ` Cornelia Huck
2015-05-30  7:27     ` Shannon Zhao
2015-05-28 13:21   ` Peter Maydell
2015-05-30 10:34   ` Paolo Bonzini [this message]
2015-05-30 11:07     ` Shannon Zhao
2015-05-28 12:34 ` [Qemu-devel] [PATCH 00/29] Fix memory leak relevant to calling qemu_allocate_irqs Michael Tokarev
2015-05-29  2:21   ` Shannon Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55699237.7070702@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    --cc=zhaoshenglong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).