Blame SOURCES/0022-semodule-Don-t-forget-to-munmap-data.patch

e65efd
From 0c4e5d70fde006977e798d6cc7d80db2e8af7bb9 Mon Sep 17 00:00:00 2001
e65efd
From: Petr Lautrbach <plautrba@redhat.com>
e65efd
Date: Tue, 23 Nov 2021 17:38:51 +0100
e65efd
Subject: [PATCH] semodule: Don't forget to munmap() data
e65efd
e65efd
semanage_module_extract() mmap()'s the module raw data but it leaves on
e65efd
the caller to munmap() them.
e65efd
e65efd
Reported-by: Ondrej Mosnacek <omosnace@redhat.com>
e65efd
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
e65efd
Acked-by: James Carter <jwcart2@gmail.com>
e65efd
---
e65efd
 policycoreutils/semodule/semodule.c | 3 +++
e65efd
 1 file changed, 3 insertions(+)
e65efd
e65efd
diff --git a/policycoreutils/semodule/semodule.c b/policycoreutils/semodule/semodule.c
e65efd
index 57f005ce2c62..94a9d131bb79 100644
e65efd
--- a/policycoreutils/semodule/semodule.c
e65efd
+++ b/policycoreutils/semodule/semodule.c
e65efd
@@ -394,6 +394,9 @@ static char *hash_module_data(const char *module_name, const int prio) {
e65efd
 	sha256_buf[i * 2] = 0;
e65efd
 
e65efd
 cleanup_extract:
e65efd
+	if (data_len > 0) {
e65efd
+		munmap(data, data_len);
e65efd
+	}
e65efd
 	semanage_module_info_destroy(sh, extract_info);
e65efd
 	free(extract_info);
e65efd
 	semanage_module_key_destroy(sh, modkey);
e65efd
-- 
e65efd
2.33.1
e65efd