This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 04/10] Class-ify lm_info_dsbt
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, gdb-patches at sourceware dot org
- Cc: Simon Marchi <simon dot marchi at polymtl dot ca>
- Date: Fri, 28 Apr 2017 16:59:14 +0100
- Subject: Re: [PATCH 04/10] Class-ify lm_info_dsbt
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E7FCD7EAB8
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E7FCD7EAB8
- References: <20170426224706.27988-1-simon.marchi@ericsson.com> <20170426224706.27988-5-simon.marchi@ericsson.com>
On 04/26/2017 11:47 PM, Simon Marchi wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> This patch makes lm_info_dsbt a "real" class. It introduces a
> destructor, initializes the field and replaces XCNEW/xfree with
> new/delete.
LGTM.
> @@ -930,8 +935,9 @@ dsbt_relocate_main_executable (void)
> dsbt_get_initial_loadmaps ();
> ldm = info->exec_loadmap;
>
> - xfree (info->main_executable_lm_info);
> - info->main_executable_lm_info = XCNEW (lm_info_dsbt);
> + if (info->main_executable_lm_info != NULL)
> + delete info->main_executable_lm_info;
Note that like with xfree, it's fine to call delete
on a NULL pointer. I spotted the same pattern on several
of the following patches in the series.
> + info->main_executable_lm_info = new lm_info_dsbt;
> info->main_executable_lm_info->map = ldm;
>
Thanks,
Pedro Alves