This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]