aboutsummaryrefslogtreecommitdiff
path: root/gdb/exceptions.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/exceptions.c')
-rw-r--r--gdb/exceptions.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index d95c58a..e640b5f 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -360,10 +360,13 @@ throw_it (enum return_reason reason, enum errors error, const char *fmt,
va_list ap)
{
struct exception e;
+ char *new_message;
- /* Save the message. */
+ /* Save the message. Create the new message before deleting the
+ old, the new message may include the old message text. */
+ new_message = xstrvprintf (fmt, ap);
xfree (last_message);
- last_message = xstrvprintf (fmt, ap);
+ last_message = new_message;
/* Create the exception. */
e.reason = reason;