This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix leak of auto_obstack objfile_per_bfd_storage->storage_obstack;
- From: Pedro Alves <palves at redhat dot com>
- To: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>, gdb-patches at sourceware dot org
- Date: Tue, 5 Sep 2017 19:31:21 +0100
- Subject: Re: [PATCH] Fix leak of auto_obstack objfile_per_bfd_storage->storage_obstack;
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C137EA4FA0
- References: <1503749191-22447-1-git-send-email-philippe.waroquiers@skynet.be>
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