qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Akihiko Odaki" <akihiko.odaki@daynix.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Michael Tokarev" <mjt@tls.msk.ru>,
	"Laurent Vivier" <laurent@vivier.eu>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v3 1/3] qemu-keymap: Free xkb allocations
Date: Wed, 22 May 2024 12:47:40 +0100	[thread overview]
Message-ID: <Zk3bXNAIGnhbEUnK@redhat.com> (raw)
In-Reply-To: <CAFEAcA_Sm=j_Q-gP=gaAKpmaMwA1-rO+JLAijzzuuhQOEFyfXA@mail.gmail.com>

On Wed, May 22, 2024 at 12:35:23PM +0100, Peter Maydell wrote:
> On Wed, 22 May 2024 at 11:49, Akihiko Odaki <akihiko.odaki@daynix.com> 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);
> > +
> >      /* add quirks */
> >      fprintf(outfile,
> >              "\n"
> 
> This is surely a sanitizer bug. We're unconditionally about
> to exit() the program here, where everything is freed, so nothing
> is leaked.

I'm not sure I'd call it a sanitizer bug, rather its expected behaviour
of sanitizers. Even if you're about to exit, its important to see info
about all memory that is not freed by that time, since it can reveal
leaks that were ongoing in the process that are valid things to fix.
To make the sanitizers usable you need to get rid of the noise. IOW,
either have to provide a file to supress reports of memory that is
expected to remain allocated, or have to free it despite being about
to exit.  Free'ing is the more maintainable strategy, as IME, supression
files get outdated over time.

So as long as the free'ing action is not unreasonably expensive, we
should just do its, so from my POV I'd

  Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  parent reply	other threads:[~2024-05-22 11:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 10:48 [PATCH v3 0/3] Fix sanitizer errors with clang 18.1.1 Akihiko Odaki
2024-05-22 10:48 ` [PATCH v3 1/3] qemu-keymap: Free xkb allocations Akihiko Odaki
2024-05-22 11:35   ` Peter Maydell
2024-05-22 11:37     ` Michael Tokarev
2024-05-22 11:47     ` Daniel P. Berrangé [this message]
2024-05-22 14:36       ` Peter Maydell
2024-05-23  9:54         ` Akihiko Odaki
2024-05-22 10:48 ` [PATCH v3 2/3] meson: Add -fno-sanitize=function Akihiko Odaki
2024-05-22 12:14   ` Thomas Huth
2024-05-22 10:48 ` [PATCH v3 3/3] meson: Drop the .fa library prefix Akihiko Odaki
2024-05-22 13:45   ` Paolo Bonzini
2024-05-22 13:49     ` Paolo Bonzini
2024-05-24  8:09     ` 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=Zk3bXNAIGnhbEUnK@redhat.com \
    --to=berrange@redhat.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=alex.bennee@linaro.org \
    --cc=bleal@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /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 NNTP newsgroup(s).