Blob Blame History Raw
From edb948fb0be62c7e8c58c1bffcc4fba8eee9d9d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Wed, 14 Jul 2021 20:13:39 +0200
Subject: [PATCH] secilc: fix memory leaks in secilc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

Found by scan-build.

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

diff --git a/secilc/secilc.c b/secilc/secilc.c
index 1c4f1ca07b97..80d3583d75cc 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