backport mokutil: Fix memory leak in export_db_keys

(cherry picked from commit ea9ae52f4bceb6fae5a051e2837b1f4b78e1bb8b)
This commit is contained in:
fly_fzc 2024-06-06 15:45:59 +08:00 committed by openeuler-sync-bot
parent 2f23512105
commit 64f1156acc
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From 71140ef59ac8f7bbe445fca2ba90a6833d3cb8c6 Mon Sep 17 00:00:00 2001
From: gaoyusong <a869920004@163.com>
Date: Thu, 22 Sep 2022 16:43:39 +0800
Subject: [PATCH] mokutil: Fix memory leak in export_db_keys
Signed-off-by: gaoyusong <a869920004@163.com>
---
src/mokutil.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mokutil.c b/src/mokutil.c
index d445311..9e947d5 100644
--- a/src/mokutil.c
+++ b/src/mokutil.c
@@ -1233,6 +1233,7 @@ export_db_keys (const DBName db_name)
list = build_mok_list (data, data_size, &mok_num);
if (list == NULL) {
+ free(data);
return -1;
}
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: mokutil
Version: 0.6.0
Release: 2
Release: 3
Epoch: 1
Summary: Tools for manipulating machine owner keys
License: GPLv3+
@ -15,6 +15,7 @@ Patch0000: 0001-Show-usage-instead-of-aborting-on-bad-flags.patch
Patch0001: 0002-mokutil-bugfix-del-unused-opt-s.patch
Patch0002: 0003-Fix-leak-of-list-in-delete_data_from_req_var.patch
Patch0003: 0004-Fix-leak-of-fd-in-mok_get_variable.patch
Patch0004: 0005-mokutil-Fix-memory-leak-in-export_db_keys.patch
%description
The utility to manipulate machines owner keys which managed in shim.
@ -62,6 +63,9 @@ make check
%{_mandir}/man1/*
%changelog
* Thu Jun 06 2024 fuanan <fuanan3@h-partners.com> - 1:0.6.0-3
- DESC: mokutil: Fix memory leak in export_db_keys
* Sat Feb 4 2023 gaoyusong <gaoyusong2@huawei.com> - 1:0.6.0-2
- DESC: Fix build error