libselinux: close the subs file if fstat failed

selabel_subs_init() returned without closing cfg when a call to fstat()
failed. Fix this.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2017-05-12 22:13:57 +02:00 committed by Stephen Smalley
parent 4a0fab43cb
commit d819de173d

View File

@ -104,7 +104,7 @@ struct selabel_sub *selabel_subs_init(const char *path,
return list;
if (fstat(fileno(cfg), &sb) < 0)
return list;
goto out;
while (fgets_unlocked(buf, sizeof(buf) - 1, cfg)) {
char *ptr = NULL;