diff mbox series

qemu-keymap: fix a small leak

Message ID 20241001152736.2684236-1-marcandre.lureau@redhat.com
State New
Headers show
Series qemu-keymap: fix a small leak | expand

Commit Message

Marc-André Lureau Oct. 1, 2024, 3:27 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Spotted thanks to ASAN:
Direct leak of 136 byte(s) in 1 object(s) allocated from:
    #0 0x7fd0216f7350 in calloc (/lib64/libasan.so.8+0xf7350) (BuildId: a4ad7eb954b390cf00f07fa10952988a41d9fc7a)
    #1 0x7fd0215d5d5c in xkb_state_new (/lib64/libxkbcommon.so.0+0x1cd5c) (BuildId: 5e4eb795acbf75d373f2930e5d0e84a568225bab)
    #2 0x5593b05bbb5d in main ../qemu-keymap.c:235

SUMMARY: AddressSanitizer: 136 byte(s) leaked in 1 allocation(s).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qemu-keymap.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Peter Maydell Oct. 1, 2024, 3:31 p.m. UTC | #1
On Tue, 1 Oct 2024 at 16:28, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Spotted thanks to ASAN:
> Direct leak of 136 byte(s) in 1 object(s) allocated from:
>     #0 0x7fd0216f7350 in calloc (/lib64/libasan.so.8+0xf7350) (BuildId: a4ad7eb954b390cf00f07fa10952988a41d9fc7a)
>     #1 0x7fd0215d5d5c in xkb_state_new (/lib64/libxkbcommon.so.0+0x1cd5c) (BuildId: 5e4eb795acbf75d373f2930e5d0e84a568225bab)
>     #2 0x5593b05bbb5d in main ../qemu-keymap.c:235
>
> SUMMARY: AddressSanitizer: 136 byte(s) leaked in 1 allocation(s).
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  qemu-keymap.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/qemu-keymap.c b/qemu-keymap.c
> index 701e4332af..603bab4661 100644
> --- a/qemu-keymap.c
> +++ b/qemu-keymap.c
> @@ -261,5 +261,6 @@ int main(int argc, char *argv[])
>              "\n"
>              "# quirks section end\n");
>
> +    xkb_state_unref(state);
>      exit(0);
>  }

https://lore.kernel.org/qemu-devel/20240723-unref-v1-1-88606ffd4552@daynix.com/
from July is similar but seems to free slightly more xkb
data structures.

-- PMM
diff mbox series

Patch

diff --git a/qemu-keymap.c b/qemu-keymap.c
index 701e4332af..603bab4661 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -261,5 +261,6 @@  int main(int argc, char *argv[])
             "\n"
             "# quirks section end\n");
 
+    xkb_state_unref(state);
     exit(0);
 }