Patchwork [pushed] handle_general_set: Remove useless xstrdup

login
register
mail settings
Submitter Simon Marchi
Date March 3, 2018, 4:29 a.m.
Message ID <20180303042916.2139-1-simon.marchi@polymtl.ca>
Download mbox | patch
Permalink /patch/26168/
State New
Headers show

Comments

Simon Marchi - March 3, 2018, 4:29 a.m.
Unless I'm missing something very obvious, this xstrdup seems
unnecessary to me.  We can pass "mode" directly to sprintf.

gdb/gdbserver/ChangeLog:

	* server.c (handle_general_set): Remove unnecessary xstrdup.
---
 gdb/gdbserver/ChangeLog | 4 ++++
 gdb/gdbserver/server.c  | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)

Patch

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 70a93876db..f7de928d18 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@ 
+2018-03-02  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* server.c (handle_general_set): Remove unnecessary xstrdup.
+
 2018-03-02  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* server.c (parse_debug_format_options): Adjust to
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index afdd5049a7..64c72bdd58 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -847,12 +847,9 @@  handle_general_set (char *own_buf)
 	req = TRIBOOL_TRUE;
       else
 	{
-	  char *mode_copy = xstrdup (mode);
-
 	  /* We don't know what this mode is, so complain to GDB.  */
 	  sprintf (own_buf, "E.Unknown thread-events mode requested: %s\n",
-		   mode_copy);
-	  xfree (mode_copy);
+		   mode);
 	  return;
 	}