A bug fix from Vladimir for a memory leak I stupidly
added to which.c.
This commit is contained in:
parent
83a2ae2184
commit
8d35134ad8
@ -54,8 +54,7 @@ extern int which_main(int argc, char **argv)
|
|||||||
found = 0;
|
found = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
char *buf;
|
char *buf;
|
||||||
buf = concat_path_file(buf, path_n);
|
buf = concat_path_file(path_n, *argv);
|
||||||
buf = concat_path_file(buf, *argv);
|
|
||||||
if (stat (buf, &filestat) == 0
|
if (stat (buf, &filestat) == 0
|
||||||
&& filestat.st_mode & S_IXUSR)
|
&& filestat.st_mode & S_IXUSR)
|
||||||
{
|
{
|
||||||
@ -63,6 +62,7 @@ extern int which_main(int argc, char **argv)
|
|||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
free(buf);
|
||||||
path_n += (strlen(path_n) + 1);
|
path_n += (strlen(path_n) + 1);
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
|
4
which.c
4
which.c
@ -54,8 +54,7 @@ extern int which_main(int argc, char **argv)
|
|||||||
found = 0;
|
found = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
char *buf;
|
char *buf;
|
||||||
buf = concat_path_file(buf, path_n);
|
buf = concat_path_file(path_n, *argv);
|
||||||
buf = concat_path_file(buf, *argv);
|
|
||||||
if (stat (buf, &filestat) == 0
|
if (stat (buf, &filestat) == 0
|
||||||
&& filestat.st_mode & S_IXUSR)
|
&& filestat.st_mode & S_IXUSR)
|
||||||
{
|
{
|
||||||
@ -63,6 +62,7 @@ extern int which_main(int argc, char **argv)
|
|||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
free(buf);
|
||||||
path_n += (strlen(path_n) + 1);
|
path_n += (strlen(path_n) + 1);
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
|
Loading…
Reference in New Issue
Block a user