[PATCH 4/6] policycoreutils: free memory on lstat failure in sestatus

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

 



In case lstat(3) fails the memory is not free'd at the end of the for
loop, due to the control flow change by continue.

Found by scan-build.

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 policycoreutils/sestatus/sestatus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c
index b37f0353..ceee0d52 100644
--- a/policycoreutils/sestatus/sestatus.c
+++ b/policycoreutils/sestatus/sestatus.c
@@ -461,6 +461,7 @@ int main(int argc, char **argv)
 				    ("%s (could not check link status (%s)!)\n",
 				     context, strerror(errno));
 				freecon(context);
+				free(fc[i]);
 				continue;
 			}
 			if (S_ISLNK(m.st_mode)) {
-- 
2.32.0




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

  Powered by Linux