[PATCH 2/3] solib_target_free_so memory leak

Christian Biesinger via gdb-patches gdb-patches@sourceware.org
Thu Dec 26 22:55:00 GMT 2019


On Tue, Dec 24, 2019 at 1:25 PM Hannes Domani via gdb-patches
<gdb-patches@sourceware.org> wrote:
>
> gdb/ChangeLog:
>
> 2019-12-24  Hannes Domani  <ssbssa@yahoo.de>
>
>         * solib-target.c (solib_target_free_so): Free li->offsets.
> ---
>  gdb/solib-target.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gdb/solib-target.c b/gdb/solib-target.c
> index 2b473d6066..52e2a6068b 100644
> --- a/gdb/solib-target.c
> +++ b/gdb/solib-target.c
> @@ -293,6 +293,7 @@ solib_target_free_so (struct so_list *so)
>
>    gdb_assert (li->name.empty ());
>
> +  xfree (li->offsets);
>    delete li;

Maybe a better fix would be to change offsets to be a unique_xmalloc_ptr?

Christian



More information about the Gdb-patches mailing list