[PATCH 2/6] secilc: fix memory leaks in secilc

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

 



When specifying -o or -f more than once, the previous allocations leak.

Found by scan-build.

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

diff --git a/secilc/secilc.c b/secilc/secilc.c
index 1c4f1ca0..80d3583d 100644
--- a/secilc/secilc.c
+++ b/secilc/secilc.c
@@ -199,9 +199,11 @@ int main(int argc, char *argv[])
 				qualified_names = 1;
 				break;
 			case 'o':
+				free(output);
 				output = strdup(optarg);
 				break;
 			case 'f':
+				free(filecontexts);
 				filecontexts = strdup(optarg);
 				break;
 			case 'G':
-- 
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