[mutter] xprops: Use g_new0 instead of malloc in size_hints_from_results()
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] xprops: Use g_new0 instead of malloc in size_hints_from_results()
- Date: Thu, 3 Oct 2019 17:28:18 +0000 (UTC)
commit 8e510a07c42e28dd200aa54332f37263ac59873f
Author: Hans de Goede <hdegoede redhat com>
Date: Mon Sep 9 15:40:12 2019 +0200
xprops: Use g_new0 instead of malloc in size_hints_from_results()
Switch the memory allocation in size_hints_from_results from a malloc call
without error-checking to g_new0 and adjust 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 34de50263..cbf5a0604 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -772,7 +772,7 @@ size_hints_from_results (GetPropertyResults *results,
raw = (xPropSizeHints*) results->prop;
- hints = malloc (sizeof (XSizeHints));
+ hints = g_new0 (XSizeHints, 1);
hints->flags = raw->flags;
hints->x = raw->x;
@@ -1078,7 +1078,7 @@ free_value (MetaPropValue *value)
g_free (value->v.class_hint.res_name);
break;
case META_PROP_VALUE_SIZE_HINTS:
- free (value->v.size_hints.hints);
+ g_free (value->v.size_hints.hints);
break;
case META_PROP_VALUE_UTF8_LIST:
g_strfreev (value->v.string_list.strings);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]