diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index 3db5448ba25fed279a6849f0952689c80a5acc85..95b6f5efbe9a731cc830d5e85b8c6be9e30d2d39 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-13  Kai Tietz  <kai.tietz@onevision.com>
+
+	* lto-plugin.c (add_output_files): Fix memory leak.
+
 2010-11-11  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR bootstrap/46397
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 78eb10988371675c8420ad291e900c7a638c404d..d2830283f6f52d83dd002bcc4ab93fca8cd99f5e 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -461,7 +461,10 @@ add_output_files (FILE *f)
       buf = s;
 cont:
       if (!fgets (buf, piece, f))
-	break;
+	{
+	  free (s);
+	  break;
+	}
       len = strlen (s);
       if (s[len - 1] != '\n')
 	{