From 4b58ff78594e649b2af73b60cd9f82efe81fa529 Mon Sep 17 00:00:00 2001 From: Pierre Le Marre Date: Wed, 25 Oct 2023 20:59:36 +0200 Subject: [PATCH] Fix memory leak in print_keymap The string buffer was not freed. --- tools/compile-keymap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/compile-keymap.c b/tools/compile-keymap.c index f49aa3c..034f389 100644 --- a/tools/compile-keymap.c +++ b/tools/compile-keymap.c @@ -244,8 +244,10 @@ print_keymap(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) if (keymap == NULL) return false; - printf("%s\n", xkb_keymap_get_as_string(keymap, - XKB_KEYMAP_FORMAT_TEXT_V1)); + char *buf = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1); + printf("%s\n", buf); + free(buf); + xkb_keymap_unref(keymap); return true; }