Fix memory leak when fill flags has PCI_FILL_PARENT
(cherry picked from commit cb1d2a44c0e824fceac0a574821bd9e20e65f257)
This commit is contained in:
parent
1fab56ebf1
commit
4f4a1b28bf
@ -0,0 +1,35 @@
|
|||||||
|
From 869a9f66b6aa723d9f90b4b3e27cd96bee5e0180 Mon Sep 17 00:00:00 2001
|
||||||
|
From: nsf.cd <zhaolei4@nsfocus.com>
|
||||||
|
Date: Fri, 9 Aug 2024 14:06:44 +0800
|
||||||
|
Subject: [PATCH] Fix memory leak when fill flags has PCI_FILL_PARENT.
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/sysfs.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/lib/sysfs.c b/lib/sysfs.c
|
||||||
|
index ffa4f9d..135a967 100644
|
||||||
|
--- a/lib/sysfs.c
|
||||||
|
+++ b/lib/sysfs.c
|
||||||
|
@@ -407,12 +407,18 @@ sysfs_fill_info(struct pci_dev *d, unsigned int flags)
|
||||||
|
path_canon = realpath(path_rel, NULL);
|
||||||
|
if (!path_canon || strcmp(path_canon, path_abs) != 0)
|
||||||
|
parent = NULL;
|
||||||
|
+
|
||||||
|
+ if (path_canon)
|
||||||
|
+ free(path_canon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
d->parent = parent;
|
||||||
|
else
|
||||||
|
clear_fill(d, PCI_FILL_PARENT);
|
||||||
|
+
|
||||||
|
+ if (path_abs)
|
||||||
|
+ free(path_abs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: pciutils
|
Name: pciutils
|
||||||
Version: 3.10.0
|
Version: 3.10.0
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: PCI bus related utilities
|
Summary: PCI bus related utilities
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml
|
URL: http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml
|
||||||
@ -11,6 +11,7 @@ Patch0: 0000-pciutils-2.2.1-idpath.patch
|
|||||||
# patch1 is from fedora, rhbz#195327
|
# patch1 is from fedora, rhbz#195327
|
||||||
Patch1: 0001-pciutils-dir-d.patch
|
Patch1: 0001-pciutils-dir-d.patch
|
||||||
Patch2: 0002-Support-specify-CC.patch
|
Patch2: 0002-Support-specify-CC.patch
|
||||||
|
Patch3: 0003-Fix-memory-leak-when-fill-flags-has-PCI_FILL_PARENT.patch
|
||||||
|
|
||||||
ExclusiveOS: Linux
|
ExclusiveOS: Linux
|
||||||
BuildRequires: gcc sed kmod-devel pkgconfig zlib-devel
|
BuildRequires: gcc sed kmod-devel pkgconfig zlib-devel
|
||||||
@ -106,6 +107,9 @@ rm -rf $RPM_BUILD_ROOT/usr/share/hwdata/pci.ids*
|
|||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Aug 9 2024 cenhuilin <cenhuilin@kylinos.cn> - 3.10.0-3
|
||||||
|
- Fix memory leak when fill flags has PCI_FILL_PARENT
|
||||||
|
|
||||||
* Thu Mar 21 2024 luofeng <luofeng13@huawei.com> - 3.10.0-2
|
* Thu Mar 21 2024 luofeng <luofeng13@huawei.com> - 3.10.0-2
|
||||||
- Support specify CC
|
- Support specify CC
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user