Michael Snyder wrote: > > OK, I think I have an elegant solution for this. I'm going to use > Joel's copy_command_lines function, and Joel's commands.exp tests, > but here's what we'll do in breakpoint.c: > > 1) bpstat_stop_status will make a copy of the bp commands > and put it in the bpstat (instead of merely copying the pointer). > > 2) bpstat_clear, bpstat_clear_actions, and bpstat_do_actions > will free the command lines instead of simply discarding them. > > Since all bpstat commands are copies instead of pointers, they > won't be affected by the deletion of the breakpoint -- and we > get to plug a memory leak as a bonus. > > Here's the patch as checked in (tested on linux, no regressions): [forgot the change log entry:]