3b5b188591
- selinux_check_passwd_access_internal(): respect deny_unknown - Silence -Wstringop-overflow warning from gcc 10.3.1 - Fixed misc compiler and static analyzer findings Resolves: rhbz#1938789
40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
From 0732233fd29c20dd54450803d9113916d3b6e28d Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Mon, 3 May 2021 17:11:11 +0200
|
|
Subject: [PATCH] libselinux: matchmediacon(): close file on error
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Found by Infer.
|
|
|
|
matchmediacon.c:25: error: Resource Leak
|
|
resource of type `_IO_FILE` acquired to `return` by call to `fopen()` at line 21, column 16 is not released after line 25, column 4.
|
|
23. while (!feof_unlocked(infile)) {
|
|
24. if (!fgets_unlocked(current_line, sizeof(current_line), infile)) {
|
|
25. return -1;
|
|
^
|
|
26. }
|
|
27. if (current_line[strlen(current_line) - 1])
|
|
|
|
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
|
|
---
|
|
libselinux/src/matchmediacon.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/libselinux/src/matchmediacon.c b/libselinux/src/matchmediacon.c
|
|
index 23d01af476d2..d3d9504348e1 100644
|
|
--- a/libselinux/src/matchmediacon.c
|
|
+++ b/libselinux/src/matchmediacon.c
|
|
@@ -22,6 +22,7 @@ int matchmediacon(const char *media, char ** con)
|
|
return -1;
|
|
while (!feof_unlocked(infile)) {
|
|
if (!fgets_unlocked(current_line, sizeof(current_line), infile)) {
|
|
+ fclose(infile);
|
|
return -1;
|
|
}
|
|
if (current_line[strlen(current_line) - 1])
|
|
--
|
|
2.32.0.rc1
|
|
|