[PATCH] sim/m32c: fix memory leaks in opc2c

Philippe Waroquiers philippe.waroquiers@skynet.be
Tue Apr 6 18:01:08 GMT 2021


On Tue, 2021-04-06 at 07:45 -0600, Tom Tromey wrote:
> Simon> I might try to take it on as a side project, but this is clearly too big
> Simon> as an immediate solution.  What do you think of the patch below that
> Simon> sets ASAN_OPTIONS while running the tools?
> 
> FWIW, I was surprised to hear that leak sanitizer reported this kind of
> leak.  IIRC, valgrind has an option to ignore these, for just the reason
> that Mike pointed out -- there's no point to handling a leak just before
> exit.
Effectively, with valgrind, you can control which leak kinds to show
at exit, and you can control separately which leak kinds have to be considered
as error:
    --show-leak-kinds=kind1,kind2,.. which leak kinds to show?
                                            [definite,possible]
    --errors-for-leak-kinds=kind1,kind2,..  which leak kinds are errors?
                                            [definite,possible]
        where kind is one of:
          definite indirect possible reachable all none

You can similarly to the answer below do leak search from within the program itself.

Philippe

> 
> Anyway, I researched a little and came across this answer:
> 
> https://stackoverflow.com/questions/51553115/how-do-i-make-leaksanitizer-ignore-end-of-program-leaks
> 
> I don't know if that's something we'd want to enshrine in the tree, but
> at least now we know there's a way available if we want it.
> 
> Tom



More information about the Gdb-patches mailing list