[RFA] Stop leaking extra_string

Keith Seitz keiths@redhat.com
Thu Mar 21 00:42:00 GMT 2013


On 03/20/2013 12:14 PM, Pedro Alves wrote:

> When we get to this bit in addr_string_to_sals (called through
> breakpoint_re_set_default):
>
> 	  if (cond_string)
> 	    b->cond_string = cond_string;
> 	  b->thread = thread;
> 	  b->task = task;
> 	  if (extra_string)
> 	    b->extra_string = extra_string;
> 	  b->condition_not_parsed = 0;
>
> Is b->extra_string always NULL here, or could we be
> leaking it here too?

I don't think that is possible right now.

When extra_string is set by find_condition_and_thread, 
init_breakpoint_sal (called from ops->create_breakpoints_sal) will error 
if extra_string isn't NULL (for non-dprintf breakpoints).

So the only way to get extra_string != NULL in breakpoint_re_set is by 
setting a pending dprintf breakpoint, which doesn't even work because 
any pending breakpoint will automatically have extra_string set to NULL 
in create_breakpoint.

But this is all largely academic for two reasons: 1) Adding an xfree 
there wouldn't hurt; 2) I'm going to submit a patch to do just that 
because I am changing it so that extra_string could be set. :-)

I've committed my original patch. Thank you for taking a look at this.

Keith



More information about the Gdb-patches mailing list