[PATCH] setup.exe: removes some memory leaks from fromcwd.cc

Pavel Tsekov ptsekov@syntrex.com
Mon Nov 5 02:04:00 GMT 2001


Robert Collins wrote:
> 

[ snip ]

> I haven't committed this leak - no changelog.

Good, cause I've messed it - I'm an idiot :(. Attached is the right one.
And here is the Changelog entry.

2001-11-05  Pavel Tsekov  <ptsekov@syntrex.com>

* fromcwd.cc (found_file): free() memory containing the version and
filepath
information for a given package, before replacing the pointers which
reference
this memory.
--- /tmp/fromcwd.cc	Fri Nov  2 17:26:21 2001
+++ /tmp/Src/cygwin-snapshot-20011018-1/winsup/cinstall/fromcwd.cc	Mon Nov  5 10:56:56 2001
@@ -116,8 +116,14 @@ found_file (char *path, unsigned int fsi
 	return;
     }
 
+  if (p->info[trust].version)
+    free(p->info[trust].version);
   p->info[trust].version = _strdup (f.ver);
+
+  if (p->info[trust].install)
+    free(p->info[trust].install);
   p->info[trust].install = _strdup (path);
+
   p->info[trust].install_size = fsize;
 }
 



More information about the Cygwin mailing list