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

Jan Kratochvil
2009-04-23T22:40:29Z

On Thu, 23 Apr 2009 23:25:32 +0200, Tom Tromey wrote:
> Looks good to me, please check it in.

Checked-in.

Thanks,
Jan

http://sourceware.org/ml/gdb-cvs/2009-04/msg00172.html

2009-04-23 Jan Kratochvil <jan.kratochvil@redhat.com>

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.

--- src/gdb/breakpoint.c 2009/03/31 16:44:17 1.390
+++ src/gdb/breakpoint.c 2009/04/23 22:38:24 1.391
@@ -5458,8 +5458,6 @@
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 @@
b->ops = ops;
b->enable_state = enabled ? bp_enabled : bp_disabled;

- update_global_location_list (1);
mention (b);
}

@@ -5812,6 +5809,9 @@
discard_cleanups (breakpoint_chain);
/* But cleanup everything else. */
do_cleanups (old_chain);
+
+ /* error call may happen here - have BREAKPOINT_CHAIN already discarded. */