checkpolicy/backport-checkpolicy-free-temporary-bounds-type.patch
wjiang b993887e8d backport patches from upstream
(cherry picked from commit c2ba662a7864600cc027fdb3d39f616df22d7a44)
2025-03-20 15:43:06 +08:00

56 lines
1.6 KiB
Diff

From 63207ce82e8ea515704731c908945e8a90fa6843 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Mon, 22 Jan 2024 14:55:05 +0100
Subject: [PATCH] checkpolicy: free temporary bounds type
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Free the temporary bounds type in the error branches.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
---
module_compiler.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/module_compiler.c b/module_compiler.c
index 119b7e36..464897cc 100644
--- a/module_compiler.c
+++ b/module_compiler.c
@@ -234,6 +234,7 @@ static int role_implicit_bounds(hashtab_t roles_tab,
if (!bounds) {
yyerror2("role %s doesn't exist, is implicit bounds of %s",
bounds_id, role_id);
+ free(bounds_id);
return -1;
}
@@ -243,6 +244,7 @@ static int role_implicit_bounds(hashtab_t roles_tab,
yyerror2("role %s has inconsistent bounds %s/%s",
role_id, bounds_id,
policydbp->p_role_val_to_name[role->bounds - 1]);
+ free(bounds_id);
return -1;
}
free(bounds_id);
@@ -479,6 +481,7 @@ static int user_implicit_bounds(hashtab_t users_tab,
if (!bounds) {
yyerror2("user %s doesn't exist, is implicit bounds of %s",
bounds_id, user_id);
+ free(bounds_id);
return -1;
}
@@ -488,6 +491,7 @@ static int user_implicit_bounds(hashtab_t users_tab,
yyerror2("user %s has inconsistent bounds %s/%s",
user_id, bounds_id,
policydbp->p_role_val_to_name[user->bounds - 1]);
+ free(bounds_id);
return -1;
}
free(bounds_id);
--
2.33.0