diff mbox

{patch lto-plugin]: Fix memory leak

Message ID AANLkTi=B=vK5O7SK24JT6KZ2Yk78BxEKYt5KrNeW=62G@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Nov. 13, 2010, 6:41 p.m. UTC
Hello,

I noticed a memory leak in add_output_files in lto-plugin.c file.

ChangeLog

2010-11-13  Kai Tietz

        * lto-plugin.c (add_output_files): Fix memory leak.

Tested for x86_64-w64-mingw32, i686-w64-mingw32, and i686-pc-cygwin.
Ok for apply?

Regards,
Kai

Comments

Diego Novillo Nov. 13, 2010, 6:43 p.m. UTC | #1
On Sat, Nov 13, 2010 at 13:41, Kai Tietz <ktietz70@googlemail.com> wrote:

> 2010-11-13  Kai Tietz
>
>        * lto-plugin.c (add_output_files): Fix memory leak.

OK.


Diego.
Kai Tietz Nov. 13, 2010, 6:49 p.m. UTC | #2
2010/11/13 Diego Novillo <dnovillo@google.com>:
> On Sat, Nov 13, 2010 at 13:41, Kai Tietz <ktietz70@googlemail.com> wrote:
>
>> 2010-11-13  Kai Tietz
>>
>>        * lto-plugin.c (add_output_files): Fix memory leak.
>
> OK.
>
>
> Diego.
>

Committed at revision 166718.

Thanks,
Kai
diff mbox

Patch

Index: lto-plugin.c
===================================================================
--- lto-plugin.c        (revision 166701)
+++ lto-plugin.c        (working copy)
@@ -461,7 +461,10 @@ 
       buf = s;
 cont:
       if (!fgets (buf, piece, f))
-       break;
+       {
+         free (s);
+         break;
+       }
       len = strlen (s);
       if (s[len - 1] != '\n')
        {