public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] xtensa: Properly strdup string when building reggroup
@ 2017-06-10 13:34 Stafford Horne
  2017-06-12  8:22 ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Stafford Horne @ 2017-06-10 13:34 UTC (permalink / raw)
  To: GDB patches; +Cc: Stafford Horne

I noticed this while looking at the reggroup intializations.  It seems
for xtensa the "cpN" reggroup->name is getting assigned to the same text
pointer for each iteration of XTENSA_MAX_COPROCESSOR.

Note 1, internally reggroup_new() does not do any xstrdup().

Note 2, I could not test this.

gdb/ChangeLog:

2017-06-10  Stafford Horne  <shorne@gmail.com>

	* xtensa-tdep.c (xtensa_init_reggroups): Use xstrdup for cpname.
---
 gdb/xtensa-tdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index f9e8584..cfbddf2 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -746,7 +746,7 @@ xtensa_init_reggroups (void)
   for (i = 0; i < XTENSA_MAX_COPROCESSOR; i++)
     {
       cpname[2] = '0' + i;
-      xtensa_cp[i] = reggroup_new (cpname, USER_REGGROUP);
+      xtensa_cp[i] = reggroup_new (xstrdup(cpname), USER_REGGROUP);
     }
 }
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-13 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-10 13:34 [PATCH] xtensa: Properly strdup string when building reggroup Stafford Horne
2017-06-12  8:22 ` Yao Qi
2017-06-12  8:38   ` Simon Marchi
2017-06-13 10:06     ` Stafford Horne

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).