On Tue, 6 Mar 2018, Herbert Xu wrote:
On Thu, Dec 01, 2016 at 10:17:07PM +0100, Andreas Bofjall wrote:
After dash had executed the exit trap handler, the trap was reset but
the pointer was never freed. This leak can be demonstrated by running
dash through valgrind and executing the following shell script:
trap foo EXIT
Fix by properly freeing the trap pointer in exitshell().
Signed-off-by: Andreas Bofjall <andr...@gazonk.org>
This is not needed because we're about to exit so all memory will
be going back to the OS.
You're correct, but the problem is the pointer is overwritten before
returning. That means before dash has exited, it is properly detected as a
leak by e.g. valgrind.
I was debugging a memory leak and it was very convenient to be able to
quickly wrap some test stuff in dash, which is when I stumbled on this
because the tests started failing on this memory leak in dash instead of
the leaks I was trying to fix.
Perhaps it's an exoteric use case, but it would be nice if it was fixed.
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html