[Qemu-devel] [PATCH 0/3] ppc: fix memory leaks

Greg Kurz posted 3 patches 8 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/149676256254.31274.13156728863519964419.stgit@bahia.lab.toulouse-stg.fr.ibm.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
hw/ppc/spapr.c       |    5 ++++-
target/ppc/kvm.c     |    5 +++--
target/ppc/kvm_ppc.h |    2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
[Qemu-devel] [PATCH 0/3] ppc: fix memory leaks
Posted by Greg Kurz 8 years, 5 months ago
Coverity just reported a memory leak introduced by this commit (QEMU 2.9):

commit df58713396f8b2deb923e39c00b10744c5c63909
Author: Thomas Huth <thuth@redhat.com>
Date:   Wed Feb 15 10:21:44 2017 +0100

    hw/ppc/spapr: Check for valid page size when hot plugging memory

It boils down to the fact that object_property_get_str() returns a string
allocated with g_strdup(), which must be deallocated with g_free() at some
point.

--
Greg

---

Greg Kurz (3):
      target/ppc: pass const pointer to kvmppc_is_mem_backend_page_size_ok()
      target/ppc: fix memory leak in kvmppc_is_mem_backend_page_size_ok()
      spapr: fix memory leak in spapr_memory_pre_plug()


 hw/ppc/spapr.c       |    5 ++++-
 target/ppc/kvm.c     |    5 +++--
 target/ppc/kvm_ppc.h |    2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)


Re: [Qemu-devel] [PATCH 0/3] ppc: fix memory leaks
Posted by David Gibson 8 years, 5 months ago
On Tue, Jun 06, 2017 at 05:22:42PM +0200, Greg Kurz wrote:
> Coverity just reported a memory leak introduced by this commit (QEMU 2.9):
> 
> commit df58713396f8b2deb923e39c00b10744c5c63909
> Author: Thomas Huth <thuth@redhat.com>
> Date:   Wed Feb 15 10:21:44 2017 +0100
> 
>     hw/ppc/spapr: Check for valid page size when hot plugging memory
> 
> It boils down to the fact that object_property_get_str() returns a string
> allocated with g_strdup(), which must be deallocated with g_free() at some
> point.

Applied to ppc-for-2.10.  Do we need to queue this for 2.9 stable as
well?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 0/3] ppc: fix memory leaks
Posted by Greg Kurz 8 years, 5 months ago
On Wed, 7 Jun 2017 09:45:06 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Tue, Jun 06, 2017 at 05:22:42PM +0200, Greg Kurz wrote:
> > Coverity just reported a memory leak introduced by this commit (QEMU 2.9):
> > 
> > commit df58713396f8b2deb923e39c00b10744c5c63909
> > Author: Thomas Huth <thuth@redhat.com>
> > Date:   Wed Feb 15 10:21:44 2017 +0100
> > 
> >     hw/ppc/spapr: Check for valid page size when hot plugging memory
> > 
> > It boils down to the fact that object_property_get_str() returns a string
> > allocated with g_strdup(), which must be deallocated with g_free() at some
> > point.  
> 
> Applied to ppc-for-2.10.  Do we need to queue this for 2.9 stable as
> well?
> 

Yes.