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 04/10] Class-ify lm_info_dsbt


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


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