]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: fix potential memleak
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 27 Aug 2021 08:27:26 +0000 (17:27 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 31 Aug 2021 12:18:49 +0000 (21:18 +0900)
src/udev/udev-builtin-net_id.c

index 0aede28f7d6e1fbdcdcb564d0a4a162acbc57cb2..9578fa00c37eb2a446cb6e40e07524362910a5de 100644 (file)
@@ -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;