Skip to content

Commit

Permalink
Fix memory leak in print_keymap
Browse files Browse the repository at this point in the history
The string buffer was not freed.
  • Loading branch information
wismill committed Oct 25, 2023
1 parent 2c485a7 commit 0adbc8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/compile-keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0adbc8a

Please sign in to comment.