Re: [patch] Fix double free on error while inserting the breakpoint

Tom Tromey
2009-04-22T23:11:42Z

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> x86 requires to build GDB with -lmcheck to make the crash reproducible.

FWIW, I reproduced this with valgrind.

Jan> 2008-11-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Jan> Fix double free on error inserting the breakpoint instruction.
Jan> * breakpoint.c (create_breakpoints): Move the
Jan> update_global_location_list call to ...
Jan> (break_command_really): ... here together with the second local call
Jan> both unified after all the cleanups.

I like this but I am unsure whether it is ok to move the call to
update_global_location_list past the call to mention.

Jan> + /* Have already BREAKPOINT_CHAIN discarded as we may get an exception while
Jan> + inserting the breakpoints which would double-free the resources both by
Jan> + BREAKPOINT_CHAIN now and during DELETE_BREAKPOINT in the future. */
Jan> + update_global_location_list (1);

I found this comment pretty hard to follow. I think the code would be
pretty clear without it.

Tom