Re: [PATCH] objtool: rework error handling in objtool_create_backup

From: Peter Zijlstra
Date: Sat Apr 30 2022 - 13:40:35 EST


On Sat, Apr 30, 2022 at 01:32:40PM -0400, Tom Rix wrote:
> The cppcheck reports this issue
> [tools/objtool/objtool.c:65]: (error) Memory leak: name
>
> This is a general problem. When ojbtool_create_backup() fails anywhere it
> returns an error without freeing any of the buffers it allocates. So
> rework the error handler to goto the appropriate free level when an error
> occurs.

If it fails, objtool terminates. Process termination releases all
resources.