[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [PATCH 3/3] spapr: fix memory leak in spapr_memory_pre
From: |
Thomas Huth |
Subject: |
Re: [Qemu-stable] [PATCH 3/3] spapr: fix memory leak in spapr_memory_pre_plug() |
Date: |
Tue, 6 Jun 2017 17:43:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
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 <address@hidden>
> ---
> 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