From owner-svn-src-all@FreeBSD.ORG Fri Jan 23 21:06:16 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 A0345106564A; Fri, 23 Jan 2009 21:06:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F41E8FC20; Fri, 23 Jan 2009 21:06:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0NL6GJo054327; Fri, 23 Jan 2009 21:06:16 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0NL6G70054326; Fri, 23 Jan 2009 21:06:16 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200901232106.n0NL6G70054326@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 23 Jan 2009 21:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187651 - head/sys/cam/scsi 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: Fri, 23 Jan 2009 21:06:17 -0000 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;