This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: make execute_control_command conform to docs
- From: Andrew Cagney <cagney at gnu dot org>
- To: David Allan <dallan at egenera dot com>
- Cc: GDB patches <gdb-patches at sources dot redhat dot com>
- Date: Tue, 24 Feb 2004 15:35:57 -0500
- Subject: Re: make execute_control_command conform to docs
- References: <1077640948.1311.61.camel@hasufel.egenera.com>
Index: cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.21
diff -u -r1.21 cli-script.c
--- cli-script.c 22 Dec 2003 03:43:19 -0000 1.21
+++ cli-script.c 24 Feb 2004 15:55:06 -0000
@@ -294,7 +294,7 @@
{
struct expression *expr;
struct command_line *current;
- struct cleanup *old_chain = 0;
+ struct cleanup *old_chain = make_cleanup (null_cleanup, 0);
struct value *val;
struct value *val_mark;
int loop;
@@ -427,8 +427,7 @@
return invalid_control;
}
- if (old_chain)
- do_cleanups (old_chain);
+ do_cleanups (old_chain);
return ret;
}
Close,
Paths where the function explicitly does a "return" such as this:
default:
warning ("Invalid control type in command structure.");
return invalid_control;
should cleanup (or better? let things flow to the end), and this:
struct cleanup *old_chain = make_cleanup (null_cleanup, 0);
...
old_chain = make_cleanup (free_current_contents, &new_line);
leaves a dangling cleanup (it is eventually processed but I'm not sure
where).
I'll re-arange the relevant code.
Andrew
PS: Remember to include a ChangeLog entry in patches.