[mutter] xprops: Use g_new0 instead of calloc in wm_hints_from_results()



commit eb8a1f42bc1389d3b319f77fc1cf3ecd5e6586f5
Author: Hans de Goede <hdegoede redhat com>
Date:   Mon Sep 9 11:08:25 2019 +0200

    xprops: Use g_new0 instead of calloc in wm_hints_from_results()
    
    Switch the memory allocation in wm_hints_from_results from a calloc call
    without error-checking to g_new0 and just the free path accordingly.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/786

 src/x11/xprops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/x11/xprops.c b/src/x11/xprops.c
index f62222e2e..d32bb263f 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -695,7 +695,7 @@ wm_hints_from_results (GetPropertyResults *results,
       return FALSE;
     }
 
-  hints = calloc (1, sizeof (XWMHints));
+  hints = g_new0 (XWMHints, 1);
 
   raw = (xPropWMHints*) results->prop;
 
@@ -1089,7 +1089,7 @@ free_value (MetaPropValue *value)
       g_free (value->v.str);
       break;
     case META_PROP_VALUE_WM_HINTS:
-      free (value->v.wm_hints);
+      g_free (value->v.wm_hints);
       break;
     case META_PROP_VALUE_CLASS_HINT:
       free (value->v.class_hint.res_class);


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