mirror of
https://github.com/troglobit/finit.git
synced 2026-10-14 10:19:36 +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, '/');
|
||||
if (!group)
|
||||
return 0;
|
||||
goto err;
|
||||
group++;
|
||||
|
||||
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);
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
err:
|
||||
fclose(fp);
|
||||
if (num)
|
||||
printf("\r%c\n", user ? ' ' : '|');
|
||||
|
||||
|
||||
Reference in new issue
Block a user