diff options
author | Jeff Law <law@redhat.com> | 1996-09-30 17:16:35 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1996-09-30 17:16:35 +0000 |
commit | e20c36baa7a156bf6d299f471142c350288e30d7 (patch) | |
tree | 49d918c404f1b6a7768e40232dea876a311b8b4b /gdb/top.c | |
parent | a98ddff362474cb4c9d824490c103a0bf6a535ea (diff) | |
download | gdb-e20c36baa7a156bf6d299f471142c350288e30d7.zip gdb-e20c36baa7a156bf6d299f471142c350288e30d7.tar.gz gdb-e20c36baa7a156bf6d299f471142c350288e30d7.tar.bz2 |
* top.c (execute_control_command): Free values from while_control
and if_control conditions after evaluation to avoid storage leaks.
From Peter Schauer.
Fixes 10442.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -813,6 +813,7 @@ execute_control_command (cmd) struct command_line *current; struct cleanup *old_chain = 0; value_ptr val; + value_ptr val_mark; int loop; enum command_control_type ret; char *new_line; @@ -852,13 +853,18 @@ execute_control_command (cmd) /* Keep iterating so long as the expression is true. */ while (loop == 1) { + int cond_result; + QUIT; /* Evaluate the expression. */ + val_mark = value_mark (); val = evaluate_expression (expr); + cond_result = value_true (val); + value_free_to_mark (val_mark); /* If the value is false, then break out of the loop. */ - if (!value_true (val)) + if (!cond_result) break; /* Execute the body of the while statement. */ @@ -906,6 +912,7 @@ execute_control_command (cmd) ret = simple_control; /* Evaluate the conditional. */ + val_mark = value_mark (); val = evaluate_expression (expr); /* Choose which arm to take commands from based on the value of the @@ -914,6 +921,7 @@ execute_control_command (cmd) current = *cmd->body_list; else if (cmd->body_count == 2) current = *(cmd->body_list + 1); + value_free_to_mark (val_mark); /* Execute commands in the given arm. */ while (current) |