From 4f6d0c5148f1cc25544638aaa51364a32b3c0594 Mon Sep 17 00:00:00 2001 From: yanshuai01 Date: Wed, 16 Oct 2024 14:50:53 +0800 Subject: [PATCH] Fix memory leak in grant_process_token_dacl_permissions --- ...in-grant_process_token_dacl_permissi.patch | 35 +++++++++++++++++++ pciutils.spec | 6 +++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0004-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch diff --git a/0004-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch b/0004-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch new file mode 100644 index 0000000..e63b2e6 --- /dev/null +++ b/0004-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch @@ -0,0 +1,35 @@ +From 6e50724345522dce3f74f076dc2a0662956ba933 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Wed, 7 Jun 2023 19:53:32 +0200 +Subject: [PATCH] libpci: i386-io-windows.h: Fix memory leak in + grant_process_token_dacl_permissions() + +When SetEntriesInAcl() call success then new_dacl allocated by this +function has to be released by LocalFree() call. + +--- + lib/i386-io-windows.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/i386-io-windows.h b/lib/i386-io-windows.h +index 6bb578c..c15e589 100644 +--- a/lib/i386-io-windows.h ++++ b/lib/i386-io-windows.h +@@ -590,12 +590,13 @@ grant_process_token_dacl_permissions(HANDLE process, DWORD permissions, HANDLE * + + if (MySetSecurityInfo(*token, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, new_dacl, NULL) != ERROR_SUCCESS) + { ++ LocalFree(new_dacl); + LocalFree(*security_descriptor); + LocalFree(owner); + CloseHandle(*token); + return FALSE; + } +- ++ LocalFree(new_dacl); + LocalFree(owner); + return TRUE; + } +-- +2.27.0 + diff --git a/pciutils.spec b/pciutils.spec index 819ae47..65341cf 100644 --- a/pciutils.spec +++ b/pciutils.spec @@ -1,6 +1,6 @@ Name: pciutils Version: 3.10.0 -Release: 3 +Release: 4 Summary: PCI bus related utilities License: GPLv2+ URL: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml @@ -12,6 +12,7 @@ Patch0: 0000-pciutils-2.2.1-idpath.patch Patch1: 0001-pciutils-dir-d.patch Patch2: 0002-Support-specify-CC.patch Patch3: 0003-Fix-memory-leak-when-fill-flags-has-PCI_FILL_PARENT.patch +Patch4: 0004-Fix-memory-leak-in-grant_process_token_dacl_permissi.patch ExclusiveOS: Linux BuildRequires: gcc sed kmod-devel pkgconfig zlib-devel @@ -107,6 +108,9 @@ rm -rf $RPM_BUILD_ROOT/usr/share/hwdata/pci.ids* rm -rf $RPM_BUILD_ROOT %changelog +* Wed Oct 16 2024 yanshuai - 3.10.0-4 +- libpci: i386-io-windows.h: Fix memory leak in grant_process_token_dacl_permissions() + * Fri Aug 9 2024 cenhuilin - 3.10.0-3 - Fix memory leak when fill flags has PCI_FILL_PARENT -- Gitee