Fix memory leak in print_keymap

The string buffer was not freed.
master
Pierre Le Marre 2023-10-25 20:59:36 +02:00 committed by Wismill
parent 171e0170c2
commit 4b58ff7859
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}