From a7b2d0fbeb4ca22ffbf56d19d06b7d1cb774e383 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 17 Jan 2018 12:33:45 -0500 Subject: [PATCH] linux-nat: Remove unnecessary xstrdup I think this xstrdup is not useful. We can pass ex.message directly to throw_error instead. gdb/ChangeLog: * linux-nat.c (linux_nat_attach): Remove xstrdup. --- gdb/ChangeLog | 4 ++++ gdb/linux-nat.c | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ad6174ba927..2a75839e41a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2018-01-17 Simon Marchi + + * linux-nat.c (linux_nat_attach): Remove xstrdup. + 2018-01-17 Eldar Abusalimov PR gdb/21559 diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index c41ea391a0b..d26ab7d5d78 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1224,10 +1224,7 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty) { pid_t pid = parse_pid_to_attach (args); struct buffer buffer; - char *message, *buffer_s; - - message = xstrdup (ex.message); - make_cleanup (xfree, message); + char *buffer_s; buffer_init (&buffer); linux_ptrace_attach_fail_reason (pid, &buffer); @@ -1237,9 +1234,9 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty) make_cleanup (xfree, buffer_s); if (*buffer_s != '\0') - throw_error (ex.error, "warning: %s\n%s", buffer_s, message); + throw_error (ex.error, "warning: %s\n%s", buffer_s, ex.message); else - throw_error (ex.error, "%s", message); + throw_error (ex.error, "%s", ex.message); } END_CATCH -- 2.30.2