[Patch] cygcheck (add_path): A little memory-leak.
Bas van Gompel
cygwin-patches.buzz@bavag.tmfweb.nl
Sun Oct 10 06:36:00 GMT 2004
In cygcheck.cc, in function add_path, if paths[num_paths] was already
in the list, the mallocced memory was not released. The trivial (IMO)
patch follows...
ChangeLog-entry:
2004-10-10 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
* cygcheck.cc (add_path): Don't leak memory when path is already in
``paths''.
--- src/winsup/utils/cygcheck.cc 9 Oct 2004 23:19:38 -0000 1.47
+++ src/winsup/utils/cygcheck.cc 10 Oct 2004 03:27:22 -0000
@@ -130,7 +130,10 @@ add_path (char *s, int maxlen)
*--e = 0;
for (int i = 1; i < num_paths; i++)
if (strcasecmp (paths[num_paths], paths[i]) == 0)
- return;
+ {
+ free (paths[num_paths]);
+ return;
+ }
num_paths++;
}
L8r,
Buzz.
--
) | | ---/ ---/ Yes, this | This message consists of true | I do not
-- | | / / really is | and false bits entirely. | mail for
) | | / / a 72 by 4 +-------------------------------+ any1 but
-- \--| /--- /--- .sigfile. | |perl -pe "s.u(z)\1.as." | me. 4^re
More information about the Cygwin-patches
mailing list