aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-02-15 11:28:19 +0100
committerMartin Liska <mliska@suse.cz>2021-02-15 16:01:58 +0100
commit40f235b5f00009ea35fcd8fae08566e65a864a46 (patch)
treebc4d7c1c9f4dfe3de6f61b65b7a4e63526df1664 /gcc
parent26cedbce4b41df859428c036569723784f7e897f (diff)
downloadgcc-40f235b5f00009ea35fcd8fae08566e65a864a46.zip
gcc-40f235b5f00009ea35fcd8fae08566e65a864a46.tar.gz
gcc-40f235b5f00009ea35fcd8fae08566e65a864a46.tar.bz2
Fix 2 more leaks related to gen_command_line_string.
gcc/ChangeLog: * toplev.c (init_asm_output): Free output of gen_command_line_string function. (process_options): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/toplev.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 05bd449..d8cc254 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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);
}
}