summaryrefslogtreecommitdiff
path: root/which.c
diff options
context:
space:
mode:
Diffstat (limited to 'which.c')
-rw-r--r--which.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/which.c b/which.c
index 1e5e9ee..b2acd78 100644
--- a/which.c
+++ b/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)