[PATCH 09/25] libselinux: getconlist: free memory on multiple level arguments

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

 



Do not leak memory if the program argument `l` got passed more than
once.

Found by clang-analyzer.

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

diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
index 76654b75..0bb28469 100644
--- a/libselinux/utils/getconlist.c
+++ b/libselinux/utils/getconlist.c
@@ -26,6 +26,7 @@ int main(int argc, char **argv)
 	while ((opt = getopt(argc, argv, "l:")) > 0) {
 		switch (opt) {
 		case 'l':
+			free(level);
 			level = strdup(optarg);
 			if (!level) {
 				fprintf(stderr, "memory allocation failure: %d(%s)\n",
-- 
2.31.1




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

  Powered by Linux