On Mon, Apr 01, 2024 at 08:25:13PM +0300, Maks Mishin wrote:
> Dynamic memory, referenced by 'naddr', is allocated at segment.c:66
> by calling function 'realloc' and lost at segment.c:92.
> 
> Found by RASU JSC.
> 
> Signed-off-by: Maks Mishin <maks.mishi...@gmail.com>
> ---
>  libdwfl/segment.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libdwfl/segment.c b/libdwfl/segment.c
> index f6a3e84e..5d6053e4 100644
> --- a/libdwfl/segment.c
> +++ b/libdwfl/segment.c
> @@ -89,6 +89,8 @@ insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr 
> end, int segndx)
>             return true;
>           }
>       }
> +       if (naddr != NULL)

You don't need this check.

> +         free(naddr);

Nit: there should be a space before '('.

Thanks for the patch,
Marek

Reply via email to