From 64f1156acc20d0ffdca3980bb06c4757c33102b3 Mon Sep 17 00:00:00 2001 From: fly_fzc <2385803914@qq.com> Date: Thu, 6 Jun 2024 15:45:59 +0800 Subject: [PATCH] backport mokutil: Fix memory leak in export_db_keys (cherry picked from commit ea9ae52f4bceb6fae5a051e2837b1f4b78e1bb8b) --- ...il-Fix-memory-leak-in-export_db_keys.patch | 25 +++++++++++++++++++ mokutil.spec | 6 ++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 0005-mokutil-Fix-memory-leak-in-export_db_keys.patch diff --git a/0005-mokutil-Fix-memory-leak-in-export_db_keys.patch b/0005-mokutil-Fix-memory-leak-in-export_db_keys.patch new file mode 100644 index 0000000..2652c23 --- /dev/null +++ b/0005-mokutil-Fix-memory-leak-in-export_db_keys.patch @@ -0,0 +1,25 @@ +From 71140ef59ac8f7bbe445fca2ba90a6833d3cb8c6 Mon Sep 17 00:00:00 2001 +From: gaoyusong +Date: Thu, 22 Sep 2022 16:43:39 +0800 +Subject: [PATCH] mokutil: Fix memory leak in export_db_keys + +Signed-off-by: gaoyusong +--- + 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 + diff --git a/mokutil.spec b/mokutil.spec index 1d39608..f4aeb8c 100644 --- a/mokutil.spec +++ b/mokutil.spec @@ -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 - 1:0.6.0-3 +- DESC: mokutil: Fix memory leak in export_db_keys + * Sat Feb 4 2023 gaoyusong - 1:0.6.0-2 - DESC: Fix build error -- Gitee