[metacity] xprops: fix memory leak
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] xprops: fix memory leak
- Date: Tue, 6 Aug 2019 20:52:01 +0000 (UTC)
commit c87f73f3b4413720a2f3e6a672826d3fec7f77a9
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Aug 6 23:47:27 2019 +0300
xprops: fix memory leak
XmbTextPropertyToTextList documentation says that XFreeStringList
should be used to free the storage for the list and its contents.
https://gitlab.gnome.org/GNOME/metacity/issues/7
src/core/xprops.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/core/xprops.c b/src/core/xprops.c
index a1cd901f..4b701af7 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -674,19 +674,21 @@ text_property_to_utf8 (Display *xdisplay,
res = XmbTextPropertyToTextList (xdisplay, prop, &local_list, &count);
if (res == XNoMemory || res == XLocaleNotSupported || res == XConverterNotFound)
- goto out;
+ return NULL;
if (count == 0)
- goto out;
+ {
+ XFreeStringList (local_list);
+ return NULL;
+ }
if (g_get_charset (&charset))
ret = g_strdup (local_list[0]);
else
ret = g_convert (local_list[0], -1, "UTF-8", charset, NULL, NULL, NULL);
- out:
- meta_XFree (local_list);
- return ret;
+ XFreeStringList (local_list);
+ return ret;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]