[PATCH 2/2] libselinux: close the subs file if fstat failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Nicolas Iooss <nicolas.iooss@xxxxxxx>
---
 libselinux/src/label.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libselinux/src/label.c b/libselinux/src/label.c
index 0e43474c352e..71a273bdeb2a 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -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;
-- 
2.12.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux