041eacc63c
Rebase on upstream commit 32611aea6543 See $ cd SELinuxProject/selinux $ git log --pretty=oneline libselinux-3.2..32611aea6543 -- libselinux Related: rhbz#1938789
35 lines
1.0 KiB
Diff
35 lines
1.0 KiB
Diff
From d0e16077d4ded64bbc878d29e0dc22b1f5e0912f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Mon, 3 May 2021 17:10:55 +0200
|
|
Subject: [PATCH] libselinux: getconlist: free memory on multiple level
|
|
arguments
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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@googlemail.com>
|
|
---
|
|
libselinux/utils/getconlist.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c
|
|
index 76654b75151a..0bb2846937ca 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.32.0
|
|
|