initctl: Fix file descriptor leak, found by Coverity

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2020-01-06 22:04:59 +01:00
1 parent a8c071c5ef
commit a5c9d0a3f4
1 file changed
+3 -2
+3 -2
View File
@@ -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 ? ' ' : '|');