backport mokutil: Fix memory leak in export_db_keys

(cherry picked from commit c96dfbb8a4e24a7a66597d2db463f99898fbafa0)
This commit is contained in:
liyuan 2023-12-22 05:53:55 +08:00 committed by openeuler-sync-bot
parent 8041e01361
commit 2d3946c7a5
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: 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 <liyuanyuan@xfusion.com> - 1:0.6.0-2
- mokutil: Fix memory leak in export_db_keys
* Wed Jun 29 2022 Chenxi Mao <chenxi.mao@suse.com> - 1:0.6.0-1
- Update to 0.6.0 with latest bug fix