fix memory leak in aug_match_mac

This commit is contained in:
zhuchengliang 2020-01-11 20:35:00 +08:00
parent 02c6be5280
commit d97d157d65
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From 478da0f8f31252be2e9e96430a8e56d9b28642ed Mon Sep 17 00:00:00 2001
From: Laine Stump <laine@laine.org>
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 <laine@laine.org>
---
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:

View File

@ -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 <buildteam@openeuler.org> - 0.2.8-17
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix memory leak in aug_match_mac()
* Fri Oct 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.2.8-16
- Type:enhancement
- Id:NA