summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-08-27 17:27:26 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-10-12 17:51:01 +0200
commit59bb407d19de624419026b77f152bf7bf5baef7a (patch)
tree7fc6308d7d497eb380c8bb910d2865e14314a95d
parenta2fa0a2ef4aeb49130e82ce1e12dbaa76b6cd2f5 (diff)
downloadsystemd-59bb407d19de624419026b77f152bf7bf5baef7a.tar.gz
udev: fix potential memleak
(cherry picked from commit 4154524d47d24bcee3ebfed939912a847ebeb1b3) (cherry picked from commit f4a8e2c2115fc901e588a1672f129e7e3371f5d7)
-rw-r--r--src/udev/udev-builtin-net_id.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 872833ebbc..e079683b21 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -102,7 +102,6 @@ static int get_virtfn_info(sd_device *dev, struct netnames *names, struct virtfn
_cleanup_(sd_device_unrefp) sd_device *physfn_pcidev = NULL;
const char *physfn_link_file, *syspath;
_cleanup_free_ char *physfn_pci_syspath = NULL;
- _cleanup_free_ char *virtfn_pci_syspath = NULL;
struct dirent *dent;
_cleanup_closedir_ DIR *dir = NULL;
char suffix[ALTIFNAMSIZ];
@@ -133,7 +132,7 @@ static int get_virtfn_info(sd_device *dev, struct netnames *names, struct virtfn
return -errno;
FOREACH_DIRENT_ALL(dent, dir, break) {
- _cleanup_free_ char *virtfn_link_file = NULL;
+ _cleanup_free_ char *virtfn_link_file = NULL, *virtfn_pci_syspath = NULL;
if (!startswith(dent->d_name, "virtfn"))
continue;