Fix a possible memory leak in asr_attach.
This commit is contained in:
parent
4b2dc3c447
commit
04ab3022a9
@ -2337,12 +2337,19 @@ asr_attach(device_t dev)
|
||||
sc->ha_pciDeviceNum = (pci_get_slot(dev) << 3) | pci_get_function(dev);
|
||||
|
||||
/* Check if the device is there? */
|
||||
if ((ASR_resetIOP(sc) == 0) ||
|
||||
((status = (PI2O_EXEC_STATUS_GET_REPLY)malloc(
|
||||
sizeof(I2O_EXEC_STATUS_GET_REPLY), M_TEMP, M_WAITOK)) == NULL) ||
|
||||
(ASR_getStatus(sc, status) == NULL)) {
|
||||
if (ASR_resetIOP(sc) == 0) {
|
||||
device_printf(dev, "Cannot reset adapter\n");
|
||||
return (EIO);
|
||||
}
|
||||
if ((status = (PI2O_EXEC_STATUS_GET_REPLY)malloc(
|
||||
sizeof(I2O_EXEC_STATUS_GET_REPLY), M_TEMP, M_NOWAIT)) == NULL) {
|
||||
device_printf(dev, "Cannot allocate memory\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
if (ASR_getStatus(sc, status) == NULL) {
|
||||
device_printf(dev, "could not initialize hardware\n");
|
||||
return(ENODEV); /* Get next, maybe better luck */
|
||||
free(status, M_TEMP);
|
||||
return(ENODEV);
|
||||
}
|
||||
sc->ha_SystemTable.OrganizationID = status->OrganizationID;
|
||||
sc->ha_SystemTable.IOP_ID = status->IOP_ID;
|
||||
|
Loading…
Reference in New Issue
Block a user