]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix 2 more leaks related to gen_command_line_string.
authorMartin Liska <mliska@suse.cz>
Mon, 15 Feb 2021 10:28:19 +0000 (11:28 +0100)
committerMartin Liska <mliska@suse.cz>
Mon, 15 Feb 2021 15:01:58 +0000 (16:01 +0100)
gcc/ChangeLog:

* toplev.c (init_asm_output): Free output of
gen_command_line_string function.
(process_options): Likewise.

gcc/toplev.c

index 05bd449eafc04c7451f44060647a456806808394..d8cc254adef2677798354697af5d7eb957c03c9a 100644 (file)
@@ -748,9 +748,10 @@ init_asm_output (const char *name)
          print_version (asm_out_file, ASM_COMMENT_START, true);
          fputs (ASM_COMMENT_START, asm_out_file);
          fputs (" options passed: ", asm_out_file);
-         fputs (gen_command_line_string (save_decoded_options,
-                                         save_decoded_options_count),
-                asm_out_file);
+         char *cmdline = gen_command_line_string (save_decoded_options,
+                                                  save_decoded_options_count);
+         fputs (cmdline, asm_out_file);
+         free (cmdline);
          fputc ('\n', asm_out_file);
        }
     }
@@ -1384,8 +1385,11 @@ process_options (void)
       if (!quiet_flag)
        {
          fputs ("options passed: ", stderr);
-         fputs (gen_command_line_string (save_decoded_options,
-                                         save_decoded_options_count), stderr);
+         char *cmdline = gen_command_line_string (save_decoded_options,
+                                                  save_decoded_options_count);
+
+         fputs (cmdline, stderr);
+         free (cmdline);
          fputc ('\n', stderr);
        }
     }