summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhanghongtao <zhanghongtao22@huawei.com>2022-08-01 15:53:57 +0800
committerzhanghongtao <zhanghongtao22@huawei.com>2022-08-01 15:53:57 +0800
commitb8de959615449fdf5b58ef08d881a77d397e86e2 (patch)
tree1af5d441268c8f9a1ce273dcf4837f17559cdcc8
parentf93c0dae5a837404a48ea7f3609c6c5c30691a7b (diff)
downloadlibpciaccess-b8de959615449fdf5b58ef08d881a77d397e86e2.tar.gz
pci_sys set NULL after free
Signed-off-by: zhanghongtao <zhanghongtao22@huawei.com>
-rw-r--r--src/freebsd_pci.c2
-rw-r--r--src/netbsd_pci.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/freebsd_pci.c b/src/freebsd_pci.c
index 3794328..709bfb6 100644
--- a/src/freebsd_pci.c
+++ b/src/freebsd_pci.c
@@ -663,12 +663,14 @@ pci_system_freebsd_create( void )
if ( ioctl( pcidev, PCIOCGETCONF, &pciconfio ) == -1) {
free( pci_sys );
+ pci_sys = NULL;
close( pcidev );
return errno;
}
if (pciconfio.status == PCI_GETCONF_ERROR ) {
free( pci_sys );
+ pci_sys = NULL;
close( pcidev );
return EINVAL;
}
diff --git a/src/netbsd_pci.c b/src/netbsd_pci.c
index 1f3bcea..b6a5ccd 100644
--- a/src/netbsd_pci.c
+++ b/src/netbsd_pci.c
@@ -942,6 +942,7 @@ pci_system_netbsd_create(void)
for (i = 0; i < nbuses; i++)
close(buses[i].fd);
free(pci_sys);
+ pci_sys = NULL;
return ENOMEM;
}