Fix memory leaks in (a|)daregister introduced in r298002

In the case where cam_iosched_init() fails, the ada and da softcs were leaked.
Instead, free them.

Reported by:	Coverity
CID:		1356039
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Conrad Meyer 2016-06-07 20:33:55 +00:00
parent 0d0338afc9
commit 75548271a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301568
2 changed files with 2 additions and 0 deletions

View File

@ -1672,6 +1672,7 @@ adaregister(struct cam_periph *periph, void *arg)
if (cam_iosched_init(&softc->cam_iosched, periph) != 0) {
printf("adaregister: Unable to probe new device. "
"Unable to allocate iosched memory\n");
free(softc, M_DEVBUF);
return(CAM_REQ_CMP_ERR);
}

View File

@ -2377,6 +2377,7 @@ daregister(struct cam_periph *periph, void *arg)
if (cam_iosched_init(&softc->cam_iosched, periph) != 0) {
printf("daregister: Unable to probe new device. "
"Unable to allocate iosched memory\n");
free(softc, M_DEVBUF);
return(CAM_REQ_CMP_ERR);
}