From 217dc9e25bce91c3e4da9ccfd7f8ccfaa360e2a7 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 23 Apr 2009 22:38:24 +0000 Subject: [PATCH] gdb/ Fix double free on error inserting the breakpoint instruction. * breakpoint.c (create_breakpoints): Move the update_global_location_list call to ... (break_command_really): ... here together with the second local call both unified after all the cleanups. --- gdb/ChangeLog | 8 ++++++++ gdb/breakpoint.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0bfe5638702..156b2b49c44 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2009-04-23 Jan Kratochvil + + Fix double free on error inserting the breakpoint instruction. + * breakpoint.c (create_breakpoints): Move the + update_global_location_list call to ... + (break_command_really): ... here together with the second local call + both unified after all the cleanups. + 2009-04-23 Sergio Durigan Junior Tom Tromey diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index cf0c5a1772b..330a53a66b7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5458,8 +5458,6 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string, cond_string, type, disposition, thread, task, ignore_count, ops, from_tty, enabled); } - - update_global_location_list (1); } /* Parse ARG which is assumed to be a SAL specification possibly @@ -5800,7 +5798,6 @@ break_command_really (char *arg, char *cond_string, int thread, b->ops = ops; b->enable_state = enabled ? bp_enabled : bp_disabled; - update_global_location_list (1); mention (b); } @@ -5812,6 +5809,9 @@ break_command_really (char *arg, char *cond_string, int thread, discard_cleanups (breakpoint_chain); /* But cleanup everything else. */ do_cleanups (old_chain); + + /* error call may happen here - have BREAKPOINT_CHAIN already discarded. */ + update_global_location_list (1); } /* Set a breakpoint. -- 2.30.2