QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Akihiko Odaki <akihiko.odaki@daynix.com>,
	Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Subject: Re: [PATCH] qemu-keymap: Free xkb allocations
Date: Sun, 5 May 2024 13:24:01 +0300	[thread overview]
Message-ID: <b3b6ba1d-3f58-45f8-96fc-800e6ec95284@tls.msk.ru> (raw)
In-Reply-To: <20240501-xkb-v1-1-f046d8e11a2b@daynix.com>

01.05.2024 10:55, Akihiko Odaki wrote:
> This fixes LeakSanitizer complaints with xkbcommon 1.6.0.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>   qemu-keymap.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/qemu-keymap.c b/qemu-keymap.c
> index 8c80f7a4ed65..7a9f38cf9863 100644
> --- a/qemu-keymap.c
> +++ b/qemu-keymap.c
> @@ -237,6 +237,9 @@ int main(int argc, char *argv[])
>       xkb_state_unref(state);
>       state = NULL;
>   
> +    xkb_keymap_unref(map);
> +    xkb_context_unref(ctx);
> +

I'd avoid freeing any resources in main() entirely,
since it's much cheaper to free whole process by the
kernel at exit time than to mess with each chunk of
allocated memory.  Dunno how useful it is to "fix"
these.

/mjt

>       /* add quirks */
>       fprintf(outfile,
>               "\n"
> 
> ---
> base-commit: c25df57ae8f9fe1c72eee2dab37d76d904ac382e
> change-id: 20240501-xkb-258483ccc5d8
> 
> Best regards,

-- 
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt



  reply	other threads:[~2024-05-05 10:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01  7:55 [PATCH] qemu-keymap: Free xkb allocations Akihiko Odaki
2024-05-05 10:24 ` Michael Tokarev [this message]
2024-05-05 10:29   ` Akihiko Odaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3b6ba1d-3f58-45f8-96fc-800e6ec95284@tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=akihiko.odaki@daynix.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).