[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/22] qemu-keymap: Make references to allocations static
From: |
Thomas Huth |
Subject: |
[PULL 20/22] qemu-keymap: Make references to allocations static |
Date: |
Wed, 29 May 2024 12:54:52 +0200 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
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 <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240524-xkb-v4-1-2de564e5c859@daynix.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
qemu-keymap.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/qemu-keymap.c b/qemu-keymap.c
index 8c80f7a4ed..701e4332af 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -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;
@@ -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,
--
2.45.1
- [PULL 09/22] target/s390x: Raise exception from helper_per_branch, (continued)
- [PULL 09/22] target/s390x: Raise exception from helper_per_branch, Thomas Huth, 2024/05/29
- [PULL 11/22] target/s390x: Fix helper_per_ifetch flags, Thomas Huth, 2024/05/29
- [PULL 12/22] target/s390x: Simplify per_ifetch, per_check_exception, Thomas Huth, 2024/05/29
- [PULL 13/22] target/s390x: Adjust check of noreturn in translate_one, Thomas Huth, 2024/05/29
- [PULL 14/22] tests/tcg/s390x: Add per.S, Thomas Huth, 2024/05/29
- [PULL 15/22] fuzz: specify audiodev for usb-audio, Thomas Huth, 2024/05/29
- [PULL 16/22] fuzz: disable leak-detection for oss-fuzz builds, Thomas Huth, 2024/05/29
- [PULL 18/22] scripts/update-linux-headers.sh: Remove temporary directory inbetween, Thomas Huth, 2024/05/29
- [PULL 17/22] hw/s390x: Remove unused macro VMSTATE_ADAPTER_ROUTES, Thomas Huth, 2024/05/29
- [PULL 19/22] scripts/update-linux-headers.sh: Fix the path of setup_data.h, Thomas Huth, 2024/05/29
- [PULL 20/22] qemu-keymap: Make references to allocations static,
Thomas Huth <=
- [PULL 21/22] lockable: Do not cast function pointers, Thomas Huth, 2024/05/29
- [PULL 22/22] qapi: Do not cast function pointers, Thomas Huth, 2024/05/29
- Re: [PULL 00/22] s390x, build-oss-fuzz and Clang -fsanitize=undefined fixes, Richard Henderson, 2024/05/29