Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jan 2009 21:06:16 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r187651 - head/sys/cam/scsi
Message-ID:  <200901232106.n0NL6G70054326@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Fri Jan 23 21:06:16 2009
New Revision: 187651
URL: http://svn.freebsd.org/changeset/base/187651

Log:
  Don't leak memory when alloc fails.
  
  Reviewed by:	scottl
  Approved by:	rwatson (mentor)
  Sponsored by:	FreeBSD Foundation
  Found with:	Coverity Prevent(tm)
  CID:		2908

Modified:
  head/sys/cam/scsi/scsi_low.c

Modified: head/sys/cam/scsi/scsi_low.c
==============================================================================
--- head/sys/cam/scsi/scsi_low.c	Fri Jan 23 21:05:16 2009	(r187650)
+++ head/sys/cam/scsi/scsi_low.c	Fri Jan 23 21:06:16 2009	(r187651)
@@ -966,16 +966,16 @@ scsi_low_rescan_bus_cam(slp)
 	struct scsi_low_softc *slp;
 {
   	struct cam_path *path;
-	union ccb *ccb = xpt_alloc_ccb();
+	union ccb *ccb; 
 	cam_status status;
 
-	bzero(ccb, sizeof(union ccb));
-
 	status = xpt_create_path(&path, xpt_periph,
 				 cam_sim_path(slp->sl_si.sim), -1, 0);
 	if (status != CAM_REQ_CMP)
 		return;
 
+	ccb = xpt_alloc_ccb();
+	bzero(ccb, sizeof(union ccb));
 	xpt_setup_ccb(&ccb->ccb_h, path, 5);
 	ccb->ccb_h.func_code = XPT_SCAN_BUS;
 	ccb->ccb_h.cbfcnp = scsi_low_cam_rescan_callback;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901232106.n0NL6G70054326>