summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2003-11-09 20:46:08 +0000
committerscottl <scottl@FreeBSD.org>2003-11-09 20:46:08 +0000
commitb5775784dd2b0165b4cd9c025e3d8ff6cb67b0e4 (patch)
tree6e89d85f9007e3456d4038c2dcbd6c3a58f63015 /sys/dev
parent63482864f7be2ba7d23ba7eee45f63ef23a84e00 (diff)
downloadFreeBSD-src-b5775784dd2b0165b4cd9c025e3d8ff6cb67b0e4.zip
FreeBSD-src-b5775784dd2b0165b4cd9c025e3d8ff6cb67b0e4.tar.gz
Free the ata_request struct after we are done using it. This should stop
the memory leak seen when using ATAPICAM.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/atapi-cam.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/ata/atapi-cam.c b/sys/dev/ata/atapi-cam.c
index 9d495ae..a95825d 100644
--- a/sys/dev/ata/atapi-cam.c
+++ b/sys/dev/ata/atapi-cam.c
@@ -549,11 +549,15 @@ atapi_poll(struct cam_sim *sim)
static void
atapi_cb(struct ata_request *request)
{
- struct atapi_hcb *hcb = (struct atapi_hcb *) request->driver;
- struct ccb_scsiio *csio = &hcb->ccb->csio;
+ struct atapi_hcb *hcb;
+ struct ccb_scsiio *csio;
u_int32_t rc;
mtx_lock(&Giant);
+
+ hcb = (struct atapi_hcb *)request->driver;
+ csio = &hcb->ccb->csio;
+
#ifdef CAMDEBUG
# define err (request->error)
if (CAM_DEBUGGED(csio->ccb_h.path, CAM_DEBUG_CDB)) {
@@ -597,8 +601,11 @@ atapi_cb(struct ata_request *request)
bcopy(hcb->dxfer_alloc, csio->data_ptr, csio->dxfer_len);
}
}
+
free_hcb_and_ccb_done(hcb, rc);
mtx_unlock(&Giant);
+
+ ata_free_request(request);
}
static void
OpenPOWER on IntegriCloud