diff options
author | Ed Maste <emaste@FreeBSD.org> | 2009-07-14 17:26:37 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2009-07-14 17:26:37 +0000 |
commit | 399831bce6dab31c4f24746aeae5bfde95144039 (patch) | |
tree | 4608153ca01a775e1a45017566c35214088f30f8 /sys/cam/scsi | |
parent | 0b73e40339f7d671080ea5b88c5eb627c53d64e7 (diff) | |
download | src-399831bce6dab31c4f24746aeae5bfde95144039.tar.gz src-399831bce6dab31c4f24746aeae5bfde95144039.zip |
Fix leaks in probestart, probedone, and scsi_scan_bus. Also free
page_list using the matching malloc type for the allocation.
Approved by: re
Reviewed by: scottl [1]
MFC after: 1 week
[1] Original patch was against xpt_cam.c, prior to the cam refactoring.
Notes
Notes:
svn path=/head/; revision=195685
Diffstat (limited to 'sys/cam/scsi')
-rw-r--r-- | sys/cam/scsi/scsi_xpt.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 8fcb457c8d0b..07bef623127b 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -836,8 +836,11 @@ probestart(struct cam_periph *periph, union ccb *start_ccb) serial_buf = NULL; device = periph->path->device; - device->serial_num = NULL; - device->serial_num_len = 0; + if (device->serial_num != NULL) { + free(device->serial_num, M_CAMXPT); + device->serial_num = NULL; + device->serial_num_len = 0; + } serial_buf = (struct scsi_vpd_unit_serial_number *) malloc(sizeof(*serial_buf), M_CAMXPT, M_NOWAIT|M_ZERO); @@ -1176,7 +1179,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) } if (page_list != NULL) - free(page_list, M_DEVBUF); + free(page_list, M_CAMXPT); if (serialnum_supported) { xpt_release_ccb(done_ccb); @@ -1561,6 +1564,7 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb) } work_ccb = xpt_alloc_ccb_nowait(); if (work_ccb == NULL) { + xpt_free_ccb((union ccb *)scan_info->cpi); free(scan_info, M_CAMXPT); xpt_free_path(path); request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; @@ -1682,6 +1686,7 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb) } if ((scan_info->cpi->hba_misc & PIM_SEQSCAN) == 0) { + xpt_free_ccb(request_ccb); break; } status = xpt_create_path(&path, xpt_periph, |