[mutter] xprops: Use g_free instead of XFree in text_property_from_results()



commit 89cd9d382dc1aea24cb5e5714276d15d1bbfa741
Author: Hans de Goede <hdegoede redhat com>
Date:   Mon Sep 9 16:06:08 2019 +0200

    xprops: Use g_free instead of XFree in text_property_from_results()
    
    results->prop is g_malloc memory so it should be free-ed with g_free not
    XFree. The same applies to the return value of text_property_from_results
    itself.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/786

 src/x11/xprops.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/x11/xprops.c b/src/x11/xprops.c
index 3632877da..f62222e2e 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -659,15 +659,13 @@ text_property_from_results (GetPropertyResults *results,
   *utf8_str_p = NULL;
 
   tp.value = results->prop;
-  results->prop = NULL;
   tp.encoding = results->type;
   tp.format = results->format;
   tp.nitems = results->n_items;
 
   *utf8_str_p = text_property_to_utf8 (results->x11_display->xdisplay, &tp);
 
-  if (tp.value != NULL)
-    XFree (tp.value);
+  g_clear_pointer (&results->prop, g_free);
 
   return *utf8_str_p != NULL;
 }
@@ -1088,7 +1086,7 @@ free_value (MetaPropValue *value)
       g_free (value->v.atom_list.atoms);
       break;
     case META_PROP_VALUE_TEXT_PROPERTY:
-      free (value->v.str);
+      g_free (value->v.str);
       break;
     case META_PROP_VALUE_WM_HINTS:
       free (value->v.wm_hints);


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