From 334355ab53bf801477ca64e9276214ad0e6def71 Mon Sep 17 00:00:00 2001 From: liyuan Date: Fri, 22 Dec 2023 05:53:55 +0800 Subject: [PATCH] backport mokutil: Fix memory leak in export_db_keys --- ...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 2028429..def4733 100644 --- a/mokutil.spec +++ b/mokutil.spec @@ -1,6 +1,6 @@ Name: mokutil Version: 0.6.0 -Release: 1 +Release: 2 Epoch: 1 Summary: Tools for manipulating machine owner keys License: GPLv3+ @@ -10,6 +10,7 @@ Patch0001: 0001-Show-usage-instead-of-aborting-on-bad-flags.patch Patch0002: 0002-mokutil-bugfix-del-unused-opt-s.patch Patch0003: 0003-Fix-leak-of-list-in-delete_data_from_req_var.patch Patch0004: 0004-Fix-leak-of-fd-in-mok_get_variable.patch +Patch0005: 0005-mokutil-Fix-memory-leak-in-export_db_keys.patch BuildRequires:gcc autoconf automake gnu-efi git openssl-devel openssl efivar-devel >= 31-1 git Conflicts: shim < 0.8-1 @@ -61,6 +62,9 @@ make check %{_mandir}/man1/* %changelog +* Fri Dec 29 2023 liyuanyuan - 1:0.6.0-2 +- mokutil: Fix memory leak in export_db_keys + * Wed Jun 29 2022 Chenxi Mao - 1:0.6.0-1 - Update to 0.6.0 with latest bug fix -- Gitee