From: "Christian Göttsche" <cgzones@googlemail.com>
To: selinux@vger.kernel.org
Subject: [PATCH 2/6] secilc: fix memory leaks in secilc
Date: Wed, 14 Jul 2021 20:13:39 +0200 [thread overview]
Message-ID: <20210714181343.58880-2-cgzones@googlemail.com> (raw)
In-Reply-To: <20210714181343.58880-1-cgzones@googlemail.com>
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 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
next prev parent reply other threads:[~2021-07-14 18:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 18:13 [PATCH 1/6] scripts/run-scan-build: update Christian Göttsche
2021-07-14 18:13 ` Christian Göttsche [this message]
2021-07-14 18:13 ` [PATCH 3/6] secilc: fix memory leaks in secilc2conf Christian Göttsche
2021-07-14 18:13 ` [PATCH 4/6] policycoreutils: free memory on lstat failure in sestatus Christian Göttsche
2021-07-14 18:13 ` [PATCH 5/6] policycoreutils: free memory of allocated context in run_init Christian Göttsche
2021-07-14 18:13 ` [PATCH 6/6] policycoreutils: free memory of allocated context in newrole Christian Göttsche
2021-07-19 16:58 ` [PATCH 1/6] scripts/run-scan-build: update James Carter
2021-07-22 13:18 ` James Carter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210714181343.58880-2-cgzones@googlemail.com \
--to=cgzones@googlemail.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).