public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] gdb: remove unexpected xstrdup in _initialize_maint_test_settings
@ 2021-12-02 19:15 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2021-12-02 19:15 UTC (permalink / raw)
  To: gdb-patches

That xstrdup is not correct, since we are assigning an std::string.  The
result of xstrdup is used to initialize the string, and then lost
forever.  Remove it.

Change-Id: Ief7771055e4bfd643ef3b285ec9fb7b1bfd14335
---
 gdb/maint-test-settings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index 9f50088833ab..ae61caa0391f 100644
--- a/gdb/maint-test-settings.c
+++ b/gdb/maint-test-settings.c
@@ -83,7 +83,7 @@ void _initialize_maint_test_settings ();
 void
 _initialize_maint_test_settings ()
 {
-  maintenance_test_settings_filename = xstrdup ("/foo/bar");
+  maintenance_test_settings_filename = "/foo/bar";
 
   add_setshow_prefix_cmd ("test-settings", class_maintenance,
 			  _("\
-- 
2.33.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-02 19:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 19:15 [pushed] gdb: remove unexpected xstrdup in _initialize_maint_test_settings Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).