43 lines
1.1 KiB
Diff
43 lines
1.1 KiB
Diff
|
From f0c354afc07419cfe4f61b72f604a648c995943e 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:42 +0200
|
||
|
Subject: [PATCH] policycoreutils: free memory of allocated context in run_init
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Found by scan-build.
|
||
|
|
||
|
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
|
||
|
---
|
||
|
policycoreutils/run_init/run_init.c | 5 +++++
|
||
|
1 file changed, 5 insertions(+)
|
||
|
|
||
|
diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c
|
||
|
index 1c5eb68e7e73..545490a25918 100644
|
||
|
--- a/policycoreutils/run_init/run_init.c
|
||
|
+++ b/policycoreutils/run_init/run_init.c
|
||
|
@@ -406,14 +406,19 @@ int main(int argc, char *argv[])
|
||
|
|
||
|
if (chdir("/")) {
|
||
|
perror("chdir");
|
||
|
+ free(new_context);
|
||
|
exit(-1);
|
||
|
}
|
||
|
|
||
|
if (setexeccon(new_context) < 0) {
|
||
|
fprintf(stderr, _("Could not set exec context to %s.\n"),
|
||
|
new_context);
|
||
|
+ free(new_context);
|
||
|
exit(-1);
|
||
|
}
|
||
|
+
|
||
|
+ free(new_context);
|
||
|
+
|
||
|
if (access("/usr/sbin/open_init_pty", X_OK) != 0) {
|
||
|
if (execvp(argv[1], argv + 1)) {
|
||
|
perror("execvp");
|
||
|
--
|
||
|
2.32.0
|
||
|
|