[PATCH 3/5] libselinux: fix memory leak in customizable_init()

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

 



Reported by Clang Analyzer:

    is_customizable_type.c:36:3: warning: Potential leak of memory pointed to by 'buf' [unix.Malloc]
       36 |                 fclose(fp);
          |                 ^~~~~~

Fixes: 9911f2ac6f77 ("libselinux: check for stream rewind failures")
Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 libselinux/src/is_customizable_type.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libselinux/src/is_customizable_type.c b/libselinux/src/is_customizable_type.c
index 9be50174..da301c60 100644
--- a/libselinux/src/is_customizable_type.c
+++ b/libselinux/src/is_customizable_type.c
@@ -33,6 +33,7 @@ static void customizable_init(void)
 	}
 
 	if (fseek(fp, 0L, SEEK_SET) == -1) {
+		free(buf);
 		fclose(fp);
 		return;
 	}
-- 
2.42.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