From 4154524d47d24bcee3ebfed939912a847ebeb1b3 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 27 Aug 2021 17:27:26 +0900 Subject: [PATCH] udev: fix potential memleak --- src/udev/udev-builtin-net_id.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 0aede28f7d..9578fa00c3 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -101,7 +101,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]; @@ -132,7 +131,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; -- 2.27.0