Fix a memory leak I introduced with the hostb/vgapci stuff.

Reported by:	Coverity (via dfr's clue-bat)
This commit is contained in:
jhb 2006-01-17 17:02:45 +00:00
parent fefbd8d12e
commit 7f6555d455
2 changed files with 16 additions and 8 deletions

View File

@ -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

View File

@ -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