summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2001-12-15 19:59:28 +0000
committerarchie <archie@FreeBSD.org>2001-12-15 19:59:28 +0000
commit27bbab02b765aab221c5b395c7000fc3e9b4f868 (patch)
tree3fdae8a202adf257de5972a637bc12ca0d9a9934 /sys
parentf980700b8ca325d157888be442f98cf67a6ef666 (diff)
downloadFreeBSD-src-27bbab02b765aab221c5b395c7000fc3e9b4f868.zip
FreeBSD-src-27bbab02b765aab221c5b395c7000fc3e9b4f868.tar.gz
Fix access-after-free bug added in revision 1.31.
Detected by: INVARIANTS MFC after: 2 days
Diffstat (limited to 'sys')
-rw-r--r--sys/pci/if_sis.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index 81ec6c4..fb5435d 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -430,6 +430,7 @@ static device_t sis_find_bridge(dev)
device_t *pci_children;
int pci_childcount = 0;
device_t *busp, *childp;
+ device_t child = NULL;
int i, j;
if ((pci_devclass = devclass_find("pci")) == NULL)
@@ -444,16 +445,16 @@ static device_t sis_find_bridge(dev)
j < pci_childcount; j++, childp++) {
if (pci_get_vendor(*childp) == SIS_VENDORID &&
pci_get_device(*childp) == 0x0008) {
- free(pci_devices, M_TEMP);
- free(pci_children, M_TEMP);
- return(*childp);
+ child = *childp;
+ goto done;
}
}
}
+done:
free(pci_devices, M_TEMP);
free(pci_children, M_TEMP);
- return(NULL);
+ return(child);
}
static void sis_read_cmos(sc, dev, dest, off, cnt)
OpenPOWER on IntegriCloud