Fix a memory leak I introduced with the hostb/vgapci stuff.
Reported by: Coverity (via dfr's clue-bat)
This commit is contained in:
parent
fefbd8d12e
commit
7f6555d455
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user