]> mj.ucw.cz Git - pciutils.git/commitdiff
Fix memory leak when fill flags has PCI_FILL_PARENT.
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:28:07 +0000 (14:28 +0100)
lib/sysfs.c

index 1bb4ae91595b9a97cce656cd63c68db3145a5382..0a4604bd6b35e80e50b2b2cef361f23e383829fd 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);
        }
     }