qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str()
@ 2018-03-29  9:09 Greg Kurz
  2018-03-29  9:09 ` [Qemu-devel] [PATCH 1/3] exec: fix memory leak in find_max_supported_pagesize() Greg Kurz
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Greg Kurz @ 2018-03-29  9:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Peter Crosthwaite, Richard Henderson,
	Cornelia Huck, Alexander Graf, David Hildenbrand, Eduardo Habkost,
	qemu-s390x, qemu-stable

According to include/qom/object.h:

/**
 * object_property_get_str:
 * @obj: the object
 * @name: the name of the property
 * @errp: returns an error if this function fails
 *
 * Returns: the value of the property, converted to a C string, or NULL if
 * an error occurs (including when the property value is not a string).
 * The caller should free the string.
 */

So I've checked all the call sites and found three places where the
string is obviously [*] leaked. Patch 2 and 3 fix very recent 2.12
commits, while patch 1 fixes a 2.4 commit (backported to 2.3.1).

Another potential candidate sits in query_memdev(), called during
the "info memdev" HMP and the "query-memdev" QMP commands, but
both take care of freeing the string eventually. Nothing to fix
there.

[*] allocated string is put in a local variable and not freed before
    returning

--
Greg

---

Greg Kurz (3):
      exec: fix memory leak in find_max_supported_pagesize()
      hw/s390x: fix memory leak in s390_init_ipl_dev()
      sev/i386: fix memory leak in sev_guest_init()


 exec.c                     |    1 +
 hw/s390x/s390-virtio-ccw.c |    5 ++++-
 target/i386/sev.c          |    4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-04-03  2:07 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-29  9:09 [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str() Greg Kurz
2018-03-29  9:09 ` [Qemu-devel] [PATCH 1/3] exec: fix memory leak in find_max_supported_pagesize() Greg Kurz
2018-03-29  9:18   ` Cornelia Huck
2018-03-29  9:44     ` Greg Kurz
2018-03-29 11:47   ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-03  2:06   ` [Qemu-devel] " Eduardo Habkost
2018-03-29  9:10 ` [Qemu-devel] [PATCH 2/3] hw/s390x: fix memory leak in s390_init_ipl_dev() Greg Kurz
2018-03-29  9:20   ` Cornelia Huck
2018-03-29  9:27   ` Igor Mammedov
2018-03-29  9:28     ` Cornelia Huck
2018-03-29  9:39     ` Greg Kurz
2018-03-29 10:31       ` Cornelia Huck
2018-03-29 11:49         ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-03-29 11:50   ` Thomas Huth
2018-03-29 12:09   ` [Qemu-devel] " Cornelia Huck
2018-03-29  9:10 ` [Qemu-devel] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init() Greg Kurz
2018-03-29  9:24   ` Cornelia Huck
2018-03-29 10:27     ` Greg Kurz
2018-03-29 11:56     ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-03  2:07   ` [Qemu-devel] " Eduardo Habkost
2018-03-31  6:39 ` [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str() no-reply

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).