mirror of
https://github.com/troglobit/finit.git
synced 2026-11-19 19:40:50 +00:00
initctl: Fix file descriptor leak, found by Coverity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
a8c071c5ef
commit
a5c9d0a3f4
1 file changed
+3
-2
+3
-2
@@ -531,7 +531,7 @@ static int dump_cgroup(const char *fpath, const struct stat *sb, int tflag, stru
|
|||||||
|
|
||||||
group = strrchr(fpath, '/');
|
group = strrchr(fpath, '/');
|
||||||
if (!group)
|
if (!group)
|
||||||
return 0;
|
goto err;
|
||||||
group++;
|
group++;
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), fp)) {
|
while (fgets(buf, sizeof(buf), fp)) {
|
||||||
@@ -552,8 +552,9 @@ static int dump_cgroup(const char *fpath, const struct stat *sb, int tflag, stru
|
|||||||
|
|
||||||
printf("\n%c :- %d %s", user ? ' ' : '|', pid, buf);
|
printf("\n%c :- %d %s", user ? ' ' : '|', pid, buf);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
|
err:
|
||||||
|
fclose(fp);
|
||||||
if (num)
|
if (num)
|
||||||
printf("\r%c\n", user ? ' ' : '|');
|
printf("\r%c\n", user ? ' ' : '|');
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user