Re: [PATCH] objtool: prevent memory leak in error paths
From: Dan Carpenter
Date: Wed Apr 14 2021 - 04:47:38 EST
On Wed, Apr 14, 2021 at 01:45:11AM +0500, Muhammad Usama Anjum wrote:
> Memory allocated by sym and sym->name isn't being freed if some error
> occurs in elf_create_undef_symbol(). Free the sym and sym->name if error
> is detected before returning NULL.
>
> Addresses-Coverity: ("Prevent memory leak")
> Fixes: 2f2f7e47f052 ("objtool: Add elf_create_undef_symbol()")
> Signed-off-by: Muhammad Usama Anjum <musamaanjum@xxxxxxxxx>
> ---
> Only build has been tested.
>
Just ignore leaks from the tools/ directory. These things run and then
exit and all the memory is freed. #OldSchoolGarbageCollector
regards,
dan carpenter