diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/break-catch-syscall.c | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a2f6aac..2402d73 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-01-01 Philippe Waroquiers <philippe.waroquiers@skynet.be> + + * break-catch-syscall.c (print_one_catch_syscall): xfree + the last text. + 2019-01-01 Joel Brobecker <brobecker@adacore.com> * top.c (print_gdb_version): Update Copyright year in version diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index 33018ec..6a911fb 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -265,7 +265,7 @@ print_one_catch_syscall (struct breakpoint *b, for (int iter : c->syscalls_to_be_caught) { - char *x = text; + char *previous_text = text; struct syscall s; get_syscall_by_number (gdbarch, iter, &s); @@ -274,14 +274,15 @@ print_one_catch_syscall (struct breakpoint *b, else text = xstrprintf ("%s%d, ", text, iter); - /* We have to xfree the last 'text' (now stored at 'x') - because xstrprintf dynamically allocates new space for it - on every call. */ - xfree (x); + /* We have to xfree previous_text because xstrprintf dynamically + allocates new space for text on every call. */ + xfree (previous_text); } /* Remove the last comma. */ text[strlen (text) - 2] = '\0'; uiout->field_string ("what", text); + /* xfree last text. */ + xfree (text); } else uiout->field_string ("what", "<any syscall>"); |