fix a bug of uses after free.

Pointed by:	dchagin
MFC after:	3 days
This commit is contained in:
Weongyo Jeong 2009-03-30 08:39:42 +00:00
parent 46b70f07bc
commit dec9af5a2b

View File

@ -163,8 +163,6 @@ malo_hal_attach(device_t dev, uint16_t devid,
return (mh);
fail:
free(mh, M_DEVBUF);
if (mh->mh_dmamap != NULL) {
bus_dmamap_unload(mh->mh_dmat, mh->mh_dmamap);
if (mh->mh_cmdbuf != NULL)
@ -174,6 +172,7 @@ fail:
}
if (mh->mh_dmat)
bus_dma_tag_destroy(mh->mh_dmat);
free(mh, M_DEVBUF);
return (NULL);
}