mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-30 10:02:15 +00:00
libselinux: src/label_android_property: do not leak fd on error
We were opening the path, but if the fstat failed or it was not a regular file we would return without closing the fd. Fix my using the common error exit path rather than just returning. Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
parent
5c0d7113de
commit
1e8f102e8c
@ -161,11 +161,10 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
||||
return -1;
|
||||
|
||||
if (fstat(fileno(fp), &sb) < 0)
|
||||
return -1;
|
||||
if (!S_ISREG(sb.st_mode)) {
|
||||
goto finish;
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!S_ISREG(sb.st_mode))
|
||||
goto finish;
|
||||
|
||||
/*
|
||||
* Two passes of the specification file. First is to get the size.
|
||||
|
Loading…
Reference in New Issue
Block a user