[gnome-desktop] test: plug two memory leaks in the xkbinfo test
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] test: plug two memory leaks in the xkbinfo test
- Date: Thu, 22 Apr 2021 02:00:51 +0000 (UTC)
commit bd3ec2204dfc66b1c602f7a1d0a687460ad9bce1
Author: Peter Hutterer <peter hutterer who-t net>
Date: Thu Apr 22 11:27:31 2021 +1000
test: plug two memory leaks in the xkbinfo test
g_uri_escape_string() returns an allocated string, we need to free it.
libgnome-desktop/test-xkb-info.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/libgnome-desktop/test-xkb-info.c b/libgnome-desktop/test-xkb-info.c
index 8ea72f52..dc409a9b 100644
--- a/libgnome-desktop/test-xkb-info.c
+++ b/libgnome-desktop/test-xkb-info.c
@@ -26,12 +26,16 @@ main (int argc, char **argv)
&xkb_variant) == FALSE) {
g_warning ("Failed to get info for layout '%s'", id);
} else {
+ char *name = g_uri_escape_string (display_name,
+ " (),<>+;:",
+ TRUE);
g_print (" %s:\n", id);
- g_print (" display name: \"%s\"\n",
- g_uri_escape_string (display_name, " (),<>+;:", TRUE));
+ g_print (" display name: \"%s\"\n", name);
g_print (" short name: %s\n", short_name);
g_print (" xkb layout: %s\n", xkb_layout);
g_print (" xkb variant: %s\n", xkb_variant);
+
+ g_free (name);
}
}
g_list_free (layouts);
@@ -49,10 +53,14 @@ main (int argc, char **argv)
const char *description = gnome_xkb_info_description_for_option (info,
group_id,
id);
+ char *desc = g_uri_escape_string (description,
+ " (),<>+;:",
+ TRUE);
g_print (" %s:\n", id);
- g_print (" description: \"%s\"\n",
- g_uri_escape_string (description, " (),<>+;:", TRUE));
+ g_print (" description: \"%s\"\n", desc);
+ g_free (desc);
+
}
g_list_free (options);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]