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

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