[PATCH] Fix leak of auto_obstack objfile_per_bfd_storage->storage_obstack;

Pedro Alves palves@redhat.com
Tue Sep 5 18:31:00 GMT 2017


On 08/26/2017 01:06 PM, Philippe Waroquiers wrote:
>   commit 23732b1e32dd58f7c731d9aee56ff0b22a645d53
>   Author: Pedro Alves <palves@redhat.com>
>   Date:   Tue Jun 27 16:22:08 2017 +0100
> changed objfile_per_bfd_storage->storage_obstack
> from  'struct obstack storage_obstack;'
> to    'auto_obstack storage_obstack;'
> So the obstack is auto allocated when the  objfile_per_bfd_storage ctor is
> manually called by get_objfile_bfd_data).
> However, the ctor call was still followed by a manual call to
>       obstack_init (&storage->storage_obstack);
> 
> This results in a bunch of leaks detected by valgrind, such as:

Whoops, sorry about that.

> gdb/ChangeLog
> 2017-08-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
> 
> 	* objfiles.c (get_objfile_bfd_data): Remove useless obstack_init
> 	call.

Patch is OK.  I'd call it obvious, even.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list