]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Fix memory leak when fill flags has PCI_FILL_PARENT. tmp
authornsf.cd <zhaolei4@nsfocus.com>
Tue, 14 Nov 2023 10:20:22 +0000 (18:20 +0800)
committerMartin Mares <mj@ucw.cz>
Fri, 29 Dec 2023 13:26:09 +0000 (14:26 +0100)
lib/sysfs.c

index 1bb4ae91595b9a97cce656cd63c68db3145a5382..c90a476a5b32817cc57cfb54f685d006eef21728 100644 (file)
@@ -409,12 +409,18 @@ sysfs_fill_info(struct pci_dev *d, unsigned int flags)
              path_canon = realpath(path_rel, NULL);
              if (!path_canon || strcmp(path_canon, path_abs) != 0)
                parent = NULL;
+
+             if (path_canon) 
+               free(path_canon);
            }
 
          if (parent)
            d->parent = parent;
          else
            clear_fill(d, PCI_FILL_PARENT);
+
+         if (path_abs) 
+           free(path_abs);
        }
     }