Skip to content
Snippets Groups Projects
Commit fef3fcfe authored by Tim Wickberg's avatar Tim Wickberg
Browse files

Fix file descriptor leaks in 'scontrol getent'.

CID 197758.
parent 60db1419
No related branches found
No related tags found
No related merge requests found
......@@ -751,8 +751,10 @@ extern void scontrol_getent(const char *node_name)
pwd = stepd_getpw(fd, stepd->protocol_version,
GETPW_MATCH_ALWAYS, 0, NULL);
if (!pwd)
if (!pwd) {
close(fd);
continue;
}
if (stepd->stepid == SLURM_EXTERN_CONT)
printf("JobId=%u.Extern:\nUser:\n", stepd->jobid);
......@@ -771,6 +773,7 @@ extern void scontrol_getent(const char *node_name)
grps = stepd_getgr(fd, stepd->protocol_version,
GETGR_MATCH_ALWAYS, 0, NULL);
if (!grps) {
close(fd);
printf("\n");
continue;
}
......@@ -781,6 +784,7 @@ extern void scontrol_getent(const char *node_name)
grps[i]->gr_gid,
(grps[i]->gr_mem) ? grps[i]->gr_mem[0] : "");
}
close(fd);
xfree_struct_group_array(grps);
printf("\n");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment