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

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