winegcc: Freed a string when it would leak memory.

Dylan Smith dylan.ah.smith at gmail.com
Sat Aug 22 00:58:07 CDT 2009


All the references to the string would be lost for this condition, so the
memory should be freed.
---
 tools/winegcc/winegcc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 83dba5d..a521937 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -595,7 +595,11 @@ static void build(struct options* opts)
     if ((output_name = strrchr(output_file, '/'))) output_name++;
     else output_name = output_file;
     if (!strchr(output_name, '.'))
+    {
+        char *old = output_file;
         output_file = strmake("%s.%s", output_file, opts->shared ? "dll" : "exe");
+        free(old);
+    }
 
     /* get the filename from the path */
     if ((output_name = strrchr(output_file, '/'))) output_name++;


More information about the wine-patches mailing list