From 4a44a5f3ebea3ddbc33aa7c72ae48ef7abc64705 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 14 Feb 2017 15:56:11 +0100 Subject: [PATCH] Fix memory leak in LTO 2017-02-14 Martin Liska * lto.c (do_stream_out): Free LTO file filename string. From-SVN: r245431 --- gcc/lto/ChangeLog | 4 ++++ gcc/lto/lto.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 8f2e0ec180c..d308c255ad0 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2017-02-14 Martin Liska + + * lto.c (do_stream_out): Free LTO file filename string. + 2017-01-19 David Malcolm * lto-lang.c (builtin_type_for_size): Convert call to diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index d77d85defb6..99d58cff4d4 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -2288,6 +2288,8 @@ do_stream_out (char *temp_filename, lto_symtab_encoder_t encoder) ipa_write_optimization_summaries (encoder); + free (CONST_CAST (char *, file->filename)); + lto_set_current_out_file (NULL); lto_obj_file_close (file); free (file); -- 2.30.2