[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] ui: Fix memory leak in qemu_xkeymap_mapping_table()
From: |
Laurent Vivier |
Subject: |
Re: [PATCH v2] ui: Fix memory leak in qemu_xkeymap_mapping_table() |
Date: |
Fri, 30 Apr 2021 18:05:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
Le 30/04/2021 à 17:50, Philippe Mathieu-Daudé a écrit :
> Refactor qemu_xkeymap_mapping_table() to have a single exit point,
> so we can easily free the memory allocated by XGetAtomName().
>
> This fixes when running a binary configured with --enable-sanitizers:
>
> Direct leak of 22 byte(s) in 1 object(s) allocated from:
> #0 0x561344a7473f in malloc (qemu-system-x86_64+0x1dab73f)
> #1 0x7fa4d9dc08aa in XGetAtomName (/lib64/libX11.so.6+0x2a8aa)
>
> Fixes: 2ec78706d18 ("ui: convert GTK and SDL1 frontends to keycodemapdb")
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> ui/x_keymap.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>