Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Feb 2009 11:03:24 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r189159 - in stable/7/sys: . cam/scsi contrib/pf dev/ath/ath_hal dev/cxgb
Message-ID:  <200902281103.n1SB3OxW007062@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sat Feb 28 11:03:24 2009
New Revision: 189159
URL: http://svn.freebsd.org/changeset/base/189159

Log:
  MFC r187651:
  
  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:
  stable/7/sys/   (props changed)
  stable/7/sys/cam/scsi/scsi_low.c
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/cam/scsi/scsi_low.c
==============================================================================
--- stable/7/sys/cam/scsi/scsi_low.c	Sat Feb 28 10:59:48 2009	(r189158)
+++ stable/7/sys/cam/scsi/scsi_low.c	Sat Feb 28 11:03:24 2009	(r189159)
@@ -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?200902281103.n1SB3OxW007062>