diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-01-28 01:39:51 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-01-28 01:39:51 +0000 |
commit | a355c7de35096f1abdcb632f75f4354842f57e45 (patch) | |
tree | d2794b11a6299ad4d2c74c1fabb1eb5634fbba81 | |
parent | 17707c23a8fe1a15bfaa5338aae20b40988f9589 (diff) | |
download | gdb-a355c7de35096f1abdcb632f75f4354842f57e45.zip gdb-a355c7de35096f1abdcb632f75f4354842f57e45.tar.gz gdb-a355c7de35096f1abdcb632f75f4354842f57e45.tar.bz2 |
2004-01-27 Paul N. Hilfinger <hilfinger@gnat.com>
* breakpoint.c (breakpoint_re_set_one): Set b->cond, b->val, and
b->exp to NULL after freeing so that error during re-parsing or
evaluation of expressions associated with breakpoint don't
eventually lead to re-freeing of storage.
Committed by Andrew Cagney.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/breakpoint.c | 21 |
2 files changed, 26 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7556773..3fa492d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2004-01-27 Paul N. Hilfinger <hilfinger@gnat.com> + + * breakpoint.c (breakpoint_re_set_one): Set b->cond, b->val, and + b->exp to NULL after freeing so that error during re-parsing or + evaluation of expressions associated with breakpoint don't + eventually lead to re-freeing of storage. + Committed by Andrew Cagney. + 2004-01-27 Andrew Cagney <cagney@redhat.com> * source.c (ambiguous_line_spec): Delete undefined declaration. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 7f66a3c..a9bd979 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6970,12 +6970,22 @@ breakpoint_re_set_one (void *bint) /* So for now, just use a global context. */ if (b->exp) - xfree (b->exp); + { + xfree (b->exp); + /* Avoid re-freeing b->exp if an error during the call to + parse_expression. */ + b->exp = NULL; + } b->exp = parse_expression (b->exp_string); b->exp_valid_block = innermost_block; mark = value_mark (); if (b->val) - value_free (b->val); + { + value_free (b->val); + /* Avoid re-freeing b->val if an error during the call to + evaluate_expression. */ + b->val = NULL; + } b->val = evaluate_expression (b->exp); release_value (b->val); if (VALUE_LAZY (b->val) && breakpoint_enabled (b)) @@ -6985,7 +6995,12 @@ breakpoint_re_set_one (void *bint) { s = b->cond_string; if (b->cond) - xfree (b->cond); + { + xfree (b->cond); + /* Avoid re-freeing b->exp if an error during the call + to parse_exp_1. */ + b->cond = NULL; + } b->cond = parse_exp_1 (&s, (struct block *) 0, 0); } if (breakpoint_enabled (b)) |