This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] eval.c:evaluate_subexp_standard: Use RAII to avoid leaks
- From: Pedro Alves <palves at redhat dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 21 Sep 2017 00:37:08 +0100
- Subject: Re: [PATCH] eval.c:evaluate_subexp_standard: Use RAII to avoid leaks
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.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 64AD47E430
- References: <1504554335-22534-1-git-send-email-palves@redhat.com>
On 09/04/2017 08:45 PM, Pedro Alves wrote:
> While working on the no-debug-info debugging improvements series, I
> noticed these bare xfree calls, which lead to leaks if
> evaluate_subexp_standard throws.
>
> Fix that by reworking make_params as a RAII class. Ends up
> eliminating a couple heap allocations too.
>
> gdb/ChangeLog:
> 2017-09-04 Pedro Alves <palves@redhat.com>
>
> * eval.c (make_params): Delete, refactored as ...
> (class fake_method): ... this new type's ctor.
> (fake_method::~fake_method): New.
> (evaluate_subexp_standard): Use 'fake_method'.
I'm pushing this in.
Thanks,
Pedro Alves