qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get


From: Greg Kurz
Subject: [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str()
Date: Thu, 29 Mar 2018 11:09:25 +0200
User-agent: StGit/0.17.1-46-g6855-dirty

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]