summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-01-17 17:02:45 +0000
committerjhb <jhb@FreeBSD.org>2006-01-17 17:02:45 +0000
commit7f6555d455f978875b3f40b757762978fed9e05c (patch)
tree7de413ef4c3c34c6c65d08f04db5c553002d0b01 /sys/pci
parentfefbd8d12e30cacbb24ea663dcbff242241d6eb9 (diff)
downloadFreeBSD-src-7f6555d455f978875b3f40b757762978fed9e05c.zip
FreeBSD-src-7f6555d455f978875b3f40b757762978fed9e05c.tar.gz
Fix a memory leak I introduced with the hostb/vgapci stuff.
Reported by: Coverity (via dfr's clue-bat)
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/agp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/pci/agp.c b/sys/pci/agp.c
index 3986589..a0deb5f 100644
--- a/sys/pci/agp.c
+++ b/sys/pci/agp.c
@@ -830,18 +830,22 @@ agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot)
device_t
agp_find_device()
{
- device_t *children;
+ device_t *children, child;
int i, count;
if (!agp_devclass)
return NULL;
if (devclass_get_devices(agp_devclass, &children, &count) != 0)
return NULL;
+ child = NULL;
for (i = 0; i < count; i++) {
- if (device_is_attached(children[i]))
- return (children[i]);
+ if (device_is_attached(children[i])) {
+ child = children[i];
+ break;
+ }
}
- return NULL;
+ free(children, M_TEMP);
+ return child;
}
enum agp_acquire_state
OpenPOWER on IntegriCloud