qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-ppc@nongnu.org, qemu-stable@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH 3/3] spapr: fix memory leak in spapr_memory_pre_plug()
Date: Tue, 6 Jun 2017 17:43:13 +0200	[thread overview]
Message-ID: <f6a1e425-7c2f-ed6e-46f9-6294f043b6c6@redhat.com> (raw)
In-Reply-To: <149676257896.31274.8551304687945725648.stgit@bahia.lab.toulouse-stg.fr.ibm.com>

On 06.06.2017 17:22, Greg Kurz wrote:
> The string returned by object_property_get_str() is dynamically allocated.
> 
> (Spotted by Coverity, CID 1375942)
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  hw/ppc/spapr.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 86e622834f63..f834a6a7dfac 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2617,8 +2617,11 @@ static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
>      if (mem_dev && !kvmppc_is_mem_backend_page_size_ok(mem_dev)) {
>          error_setg(errp, "Memory backend has bad page size. "
>                     "Use 'memory-backend-file' with correct mem-path.");
> -        return;
> +        goto out;
>      }
> +
> +out:
> +    g_free(mem_dev);
>  }

You don't need the goto and the "out" label here.

 Thomas

  reply	other threads:[~2017-06-06 15:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 15:22 [Qemu-devel] [PATCH 0/3] ppc: fix memory leaks Greg Kurz
2017-06-06 15:22 ` [Qemu-devel] [PATCH 1/3] target/ppc: pass const pointer to kvmppc_is_mem_backend_page_size_ok() Greg Kurz
2017-06-06 15:33   ` Philippe Mathieu-Daudé
2017-06-06 15:34   ` Thomas Huth
2017-06-06 15:46   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-06-06 16:12   ` [Qemu-devel] [PATCH v2] target/ppc: pass const string " Greg Kurz
2017-06-06 16:34     ` Thomas Huth
2017-06-06 15:22 ` [Qemu-devel] [PATCH 2/3] target/ppc: fix memory leak in kvmppc_is_mem_backend_page_size_ok() Greg Kurz
2017-06-06 15:28   ` Peter Maydell
2017-06-06 15:41     ` Greg Kurz
2017-06-06 15:43       ` Peter Maydell
2017-06-06 15:41   ` Thomas Huth
2017-06-06 15:22 ` [Qemu-devel] [PATCH 3/3] spapr: fix memory leak in spapr_memory_pre_plug() Greg Kurz
2017-06-06 15:43   ` Thomas Huth [this message]
2017-06-06 15:55     ` Greg Kurz
2017-06-06 23:45 ` [Qemu-devel] [PATCH 0/3] ppc: fix memory leaks David Gibson
2017-06-07  5:45   ` Greg Kurz

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=f6a1e425-7c2f-ed6e-46f9-6294f043b6c6@redhat.com \
    --to=thuth@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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).