From b8de959615449fdf5b58ef08d881a77d397e86e2 Mon Sep 17 00:00:00 2001 From: zhanghongtao Date: Mon, 1 Aug 2022 15:53:57 +0800 Subject: pci_sys set NULL after free Signed-off-by: zhanghongtao --- src/freebsd_pci.c | 2 ++ src/netbsd_pci.c | 1 + 2 files changed, 3 insertions(+) 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; } -- cgit v1.2.1