From d8b9bd5c2a90d6855478f05c8fb38bd5df2733a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 14 Jul 2021 20:13:41 +0200 Subject: [PATCH] policycoreutils: free memory on lstat failure in sestatus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- policycoreutils/sestatus/sestatus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c index b37f03533afd..ceee0d523f9a 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