diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-05-07 22:45:06 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-05-07 22:45:06 +0000 |
commit | 8d35134ad8d83acd76b32eb1e9b6255a00c4556b (patch) | |
tree | ce3503e19d0561a5556055e10018c1f5d8ed9e2b | |
parent | 83a2ae2184f5a77adfc4c0207aee5d195991a1ab (diff) | |
download | busybox-8d35134ad8d83acd76b32eb1e9b6255a00c4556b.tar.gz |
A bug fix from Vladimir for a memory leak I stupidly
added to which.c.
-rw-r--r-- | findutils/which.c | 4 | ||||
-rw-r--r-- | which.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/findutils/which.c b/findutils/which.c index 1e5e9eed5..b2acd78de 100644 --- a/findutils/which.c +++ b/findutils/which.c @@ -54,8 +54,7 @@ extern int which_main(int argc, char **argv) found = 0; for (i = 0; i < count; i++) { char *buf; - buf = concat_path_file(buf, path_n); - buf = concat_path_file(buf, *argv); + buf = concat_path_file(path_n, *argv); if (stat (buf, &filestat) == 0 && filestat.st_mode & S_IXUSR) { @@ -63,6 +62,7 @@ extern int which_main(int argc, char **argv) found = 1; break; } + free(buf); path_n += (strlen(path_n) + 1); } if (!found) @@ -54,8 +54,7 @@ extern int which_main(int argc, char **argv) found = 0; for (i = 0; i < count; i++) { char *buf; - buf = concat_path_file(buf, path_n); - buf = concat_path_file(buf, *argv); + buf = concat_path_file(path_n, *argv); if (stat (buf, &filestat) == 0 && filestat.st_mode & S_IXUSR) { @@ -63,6 +62,7 @@ extern int which_main(int argc, char **argv) found = 1; break; } + free(buf); path_n += (strlen(path_n) + 1); } if (!found) |