From d97d157d659d4d874311c2b99557fa0eae7b0c38 Mon Sep 17 00:00:00 2001 From: zhuchengliang Date: Sat, 11 Jan 2020 20:35:00 +0800 Subject: [PATCH] fix memory leak in aug_match_mac --- Fix-memory-leak-in-aug-match-mac.patch | 25 +++++++++++++++++++++++++ netcf.spec | 9 ++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Fix-memory-leak-in-aug-match-mac.patch diff --git a/Fix-memory-leak-in-aug-match-mac.patch b/Fix-memory-leak-in-aug-match-mac.patch new file mode 100644 index 0000000..7ecba75 --- /dev/null +++ b/Fix-memory-leak-in-aug-match-mac.patch @@ -0,0 +1,25 @@ +From 478da0f8f31252be2e9e96430a8e56d9b28642ed Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Sep 18 2018 18:30:02 +0000 +Subject: Fix memory leak in aug_match_mac() + + +mac_lower has memory allocated to it, but it was only freed in case of +an error. + +Signed-off-by: Laine Stump + +--- + +diff --git a/src/dutil_linux.c b/src/dutil_linux.c +index 742153a..80c08f7 100644 +--- a/src/dutil_linux.c ++++ b/src/dutil_linux.c +@@ -423,6 +423,7 @@ int aug_match_mac(struct netcf *ncf, const char *mac, char ***matches) { + (*matches)[i] = n; + } + ++ FREE(mac_lower); + return nmatches; + + error: diff --git a/netcf.spec b/netcf.spec index b3ec677..25c3d16 100644 --- a/netcf.spec +++ b/netcf.spec @@ -1,6 +1,6 @@ Name: netcf Version: 0.2.8 -Release: 16 +Release: 17 Summary: Cross-platform network configuration library License: LGPLv2+ URL: https://pagure.io/netcf @@ -10,6 +10,7 @@ Patch0000: 0000-netcf-call-aug_load-at-most-once-per-second.patch Patch0001: 0001-netcf-optimize-aug_match-query-for-all-ifcfg-files-related.patch Patch0002: 0002-netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch Patch0003: 0003-netcf-Properly-classify-bond-devices-with-no-slaves.patch +Patch0004: Fix-memory-leak-in-aug-match-mac.patch BuildRequires: autoconf automake augeas-devel gcc git gettext-devel libnl3-devel libtool BuildRequires: libxml2-devel libxslt-devel perl-podlators readline-devel systemd /usr/bin/pod2man @@ -83,6 +84,12 @@ make check %{_mandir}/man1/ncftool.1* %changelog +* Sat Jan 11 2020 openEuler Buildteam - 0.2.8-17 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix memory leak in aug_match_mac() + * Fri Oct 25 2019 openEuler Buildteam - 0.2.8-16 - Type:enhancement - Id:NA