mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
* 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.
This commit is contained in:
parent
a98ddff362
commit
e20c36baa7
@ -1,3 +1,9 @@
|
|||||||
|
Mon Sep 30 11:16:34 1996 Jeffrey A Law (law@cygnus.com)
|
||||||
|
|
||||||
|
* top.c (execute_control_command): Free values from while_control
|
||||||
|
and if_control conditions after evaluation to avoid storage leaks.
|
||||||
|
From Peter Schauer.
|
||||||
|
|
||||||
start-sanitize-v850
|
start-sanitize-v850
|
||||||
Fri Sep 27 17:43:06 1996 Stu Grossman (grossman@critters.cygnus.com)
|
Fri Sep 27 17:43:06 1996 Stu Grossman (grossman@critters.cygnus.com)
|
||||||
|
|
||||||
|
10
gdb/top.c
10
gdb/top.c
@ -813,6 +813,7 @@ execute_control_command (cmd)
|
|||||||
struct command_line *current;
|
struct command_line *current;
|
||||||
struct cleanup *old_chain = 0;
|
struct cleanup *old_chain = 0;
|
||||||
value_ptr val;
|
value_ptr val;
|
||||||
|
value_ptr val_mark;
|
||||||
int loop;
|
int loop;
|
||||||
enum command_control_type ret;
|
enum command_control_type ret;
|
||||||
char *new_line;
|
char *new_line;
|
||||||
@ -852,13 +853,18 @@ execute_control_command (cmd)
|
|||||||
/* Keep iterating so long as the expression is true. */
|
/* Keep iterating so long as the expression is true. */
|
||||||
while (loop == 1)
|
while (loop == 1)
|
||||||
{
|
{
|
||||||
|
int cond_result;
|
||||||
|
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
/* Evaluate the expression. */
|
/* Evaluate the expression. */
|
||||||
|
val_mark = value_mark ();
|
||||||
val = evaluate_expression (expr);
|
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 the value is false, then break out of the loop. */
|
||||||
if (!value_true (val))
|
if (!cond_result)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Execute the body of the while statement. */
|
/* Execute the body of the while statement. */
|
||||||
@ -906,6 +912,7 @@ execute_control_command (cmd)
|
|||||||
ret = simple_control;
|
ret = simple_control;
|
||||||
|
|
||||||
/* Evaluate the conditional. */
|
/* Evaluate the conditional. */
|
||||||
|
val_mark = value_mark ();
|
||||||
val = evaluate_expression (expr);
|
val = evaluate_expression (expr);
|
||||||
|
|
||||||
/* Choose which arm to take commands from based on the value of the
|
/* 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;
|
current = *cmd->body_list;
|
||||||
else if (cmd->body_count == 2)
|
else if (cmd->body_count == 2)
|
||||||
current = *(cmd->body_list + 1);
|
current = *(cmd->body_list + 1);
|
||||||
|
value_free_to_mark (val_mark);
|
||||||
|
|
||||||
/* Execute commands in the given arm. */
|
/* Execute commands in the given arm. */
|
||||||
while (current)
|
while (current)
|
||||||
|
Loading…
Reference in New Issue
Block a user