mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-22 22:12:16 +00:00
policycoreutils: checkmodule: fd leak reading policy
We never closed the fd to the policy file. Close this fd as soon as we are finished with it. Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
parent
1db01640ee
commit
87e8d46f29
@ -63,10 +63,12 @@ static int read_binary_policy(policydb_t * p, char *file, char *progname)
|
||||
if (fstat(fd, &sb) < 0) {
|
||||
fprintf(stderr, "Can't stat '%s': %s\n",
|
||||
file, strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
map =
|
||||
mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||
close(fd);
|
||||
if (map == MAP_FAILED) {
|
||||
fprintf(stderr, "Can't map '%s': %s\n", file, strerror(errno));
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user