aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-07 22:45:06 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-07 22:45:06 +0000
commit8d35134ad8d83acd76b32eb1e9b6255a00c4556b (patch)
treece3503e19d0561a5556055e10018c1f5d8ed9e2b
parent83a2ae2184f5a77adfc4c0207aee5d195991a1ab (diff)
downloadbusybox-w32-8d35134ad8d83acd76b32eb1e9b6255a00c4556b.tar.gz
busybox-w32-8d35134ad8d83acd76b32eb1e9b6255a00c4556b.tar.bz2
busybox-w32-8d35134ad8d83acd76b32eb1e9b6255a00c4556b.zip
A bug fix from Vladimir for a memory leak I stupidly
added to which.c.
-rw-r--r--findutils/which.c4
-rw-r--r--which.c4
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)
54 found = 0; 54 found = 0;
55 for (i = 0; i < count; i++) { 55 for (i = 0; i < count; i++) {
56 char *buf; 56 char *buf;
57 buf = concat_path_file(buf, path_n); 57 buf = concat_path_file(path_n, *argv);
58 buf = concat_path_file(buf, *argv);
59 if (stat (buf, &filestat) == 0 58 if (stat (buf, &filestat) == 0
60 && filestat.st_mode & S_IXUSR) 59 && filestat.st_mode & S_IXUSR)
61 { 60 {
@@ -63,6 +62,7 @@ extern int which_main(int argc, char **argv)
63 found = 1; 62 found = 1;
64 break; 63 break;
65 } 64 }
65 free(buf);
66 path_n += (strlen(path_n) + 1); 66 path_n += (strlen(path_n) + 1);
67 } 67 }
68 if (!found) 68 if (!found)
diff --git a/which.c b/which.c
index 1e5e9eed5..b2acd78de 100644
--- a/which.c
+++ b/which.c
@@ -54,8 +54,7 @@ extern int which_main(int argc, char **argv)
54 found = 0; 54 found = 0;
55 for (i = 0; i < count; i++) { 55 for (i = 0; i < count; i++) {
56 char *buf; 56 char *buf;
57 buf = concat_path_file(buf, path_n); 57 buf = concat_path_file(path_n, *argv);
58 buf = concat_path_file(buf, *argv);
59 if (stat (buf, &filestat) == 0 58 if (stat (buf, &filestat) == 0
60 && filestat.st_mode & S_IXUSR) 59 && filestat.st_mode & S_IXUSR)
61 { 60 {
@@ -63,6 +62,7 @@ extern int which_main(int argc, char **argv)
63 found = 1; 62 found = 1;
64 break; 63 break;
65 } 64 }
65 free(buf);
66 path_n += (strlen(path_n) + 1); 66 path_n += (strlen(path_n) + 1);
67 } 67 }
68 if (!found) 68 if (!found)