summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-04-22 11:27:31 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-04-22 11:45:12 +1000
commitbd3ec2204dfc66b1c602f7a1d0a687460ad9bce1 (patch)
treed42be704d6e35217cbfa4bbf187f2cd07fd9188c
parent30bfd9d6dc5805f8be6776640dc5f4e7fc296de9 (diff)
downloadgnome-desktop-bd3ec2204dfc66b1c602f7a1d0a687460ad9bce1.tar.gz
test: plug two memory leaks in the xkbinfo test
g_uri_escape_string() returns an allocated string, we need to free it.
-rw-r--r--libgnome-desktop/test-xkb-info.c16
1 files 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);
}