Skip to content

Commit

Permalink
qemu-keymap: Make references to allocations static
Browse files Browse the repository at this point in the history
LeakSanitizer complains about allocations whose references are held
only by automatic variables. It is possible to free them to suppress
the complaints, but it is a chore to make sure they are freed in all
exit paths so make them static instead.

Signed-off-by: Akihiko Odaki <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
  • Loading branch information
akihikodaki authored and huth committed May 29, 2024
1 parent bde26d9 commit 2523baf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions qemu-keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ static xkb_mod_mask_t get_mod(struct xkb_keymap *map, const char *name)

int main(int argc, char *argv[])
{
struct xkb_context *ctx;
struct xkb_keymap *map;
struct xkb_state *state;
static struct xkb_context *ctx;
static struct xkb_keymap *map;
static struct xkb_state *state;
xkb_mod_index_t mod, mods;
int rc;

Expand Down Expand Up @@ -234,8 +234,6 @@ int main(int argc, char *argv[])

state = xkb_state_new(map);
xkb_keymap_key_for_each(map, walk_map, state);
xkb_state_unref(state);
state = NULL;

/* add quirks */
fprintf(outfile,
Expand Down

0 comments on commit 2523baf

Please sign in to comment.