public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] x86: don't leak sub-architecture accumulated strings
@ 2022-07-06  7:22 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2022-07-06  7:22 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d92c7521f9b01841f27a16502819081e992dd0f5

commit d92c7521f9b01841f27a16502819081e992dd0f5
Author: Jan Beulich <jbeulich@suse.com>
Date:   Wed Jul 6 09:20:29 2022 +0200

    x86: don't leak sub-architecture accumulated strings
    
    While it may not be necessary in i386_target_format() (but then setting
    the variable to NULL also wouldn't be necessary), at least in the other
    cases strings may already have accumulated.

Diff:
---
 gas/config/tc-i386.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index e2b618fe302..4829ff8aaad 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2738,6 +2738,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
 		  check_cpu_arch_compatible (string, cpu_arch[j].flags);
 
 		  cpu_arch_name = cpu_arch[j].name;
+		  free (cpu_sub_arch_name);
 		  cpu_sub_arch_name = NULL;
 		  cpu_arch_flags = cpu_arch[j].flags;
 		  if (flag_code == CODE_64BIT)
@@ -13234,6 +13235,7 @@ md_parse_option (int c, const char *arg)
 		    continue;
 
 		  cpu_arch_name = cpu_arch[j].name;
+		  free (cpu_sub_arch_name);
 		  cpu_sub_arch_name = NULL;
 		  cpu_arch_flags = cpu_arch[j].flags;
 		  cpu_arch_isa = cpu_arch[j].type;
@@ -13897,6 +13899,7 @@ i386_target_format (void)
 	{
 	  static const i386_cpu_flags iamcu_flags = CPU_IAMCU_FLAGS;
 	  cpu_arch_name = "iamcu";
+	  free (cpu_sub_arch_name);
 	  cpu_sub_arch_name = NULL;
 	  cpu_arch_flags = iamcu_flags;
 	  cpu_arch_isa = PROCESSOR_IAMCU;


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

only message in thread, other threads:[~2022-07-06  7:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06  7:22 [binutils-gdb] x86: don't leak sub-architecture accumulated strings Jan Beulich

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