From owner-svn-src-all@FreeBSD.ORG Tue Sep 15 02:23:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ADB6106566C; Tue, 15 Sep 2009 02:23:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC97A8FC12; Tue, 15 Sep 2009 02:23:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8F2NGBi073049; Tue, 15 Sep 2009 02:23:16 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8F2NGeu073047; Tue, 15 Sep 2009 02:23:16 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200909150223.n8F2NGeu073047@svn.freebsd.org> From: Ed Maste Date: Tue, 15 Sep 2009 02:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197213 - stable/7/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 02:23:17 -0000 Author: emaste Date: Tue Sep 15 02:23:16 2009 New Revision: 197213 URL: http://svn.freebsd.org/changeset/base/197213 Log: MFC r195685: Fix leaks in probestart, probedone, and scsi_scan_bus. Also free page_list using the matching malloc type for the allocation. (In HEAD these functions have moved to scsi_xpt.c) Reviewed by: scottl Modified: stable/7/sys/cam/cam_xpt.c Modified: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Tue Sep 15 02:22:57 2009 (r197212) +++ stable/7/sys/cam/cam_xpt.c Tue Sep 15 02:23:16 2009 (r197213) @@ -5240,6 +5240,7 @@ xpt_scan_bus(struct cam_periph *periph, } 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; @@ -5360,6 +5361,7 @@ xpt_scan_bus(struct cam_periph *periph, } if ((scan_info->cpi->hba_misc & PIM_SEQSCAN) == 0) { + xpt_free_ccb(request_ccb); break; } status = xpt_create_path(&path, xpt_periph, @@ -5828,8 +5830,11 @@ probestart(struct cam_periph *periph, un 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); @@ -6168,7 +6173,7 @@ probedone(struct cam_periph *periph, uni } if (page_list != NULL) - free(page_list, M_DEVBUF); + free(page_list, M_CAMXPT); if (serialnum_supported) { xpt_release_ccb(done_ccb);