From: nsf.cd Date: Tue, 14 Nov 2023 10:20:22 +0000 (+0800) Subject: Fix memory leak when fill flags has PCI_FILL_PARENT. X-Git-Tag: v3.11.0~76 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=869a9f66b6aa723d9f90b4b3e27cd96bee5e0180;p=pciutils.git Fix memory leak when fill flags has PCI_FILL_PARENT. --- 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); } }