diff options
author | nsf.cd <zhaolei4@nsfocus.com> | 2023-11-14 18:20:22 +0800 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2023-12-29 14:28:07 +0100 |
commit | 869a9f66b6aa723d9f90b4b3e27cd96bee5e0180 (patch) | |
tree | f3685ed82b4c2eff9a928c6737ac09a127915752 | |
parent | 3d2d69cbc55016c4850ab7333de8e3884ec9d498 (diff) | |
download | pciutils-869a9f66b6aa723d9f90b4b3e27cd96bee5e0180.tar.gz |
Fix memory leak when fill flags has PCI_FILL_PARENT.
-rw-r--r-- | lib/sysfs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c index 1bb4ae9..0a4604b 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -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); } } |