svn commit: r325857 - head/sys/cam

Alan Somers asomers at FreeBSD.org
Wed Nov 15 15:52:08 UTC 2017


Author: asomers
Date: Wed Nov 15 15:52:06 2017
New Revision: 325857
URL: https://svnweb.freebsd.org/changeset/base/325857

Log:
  Remove a double free(9) in xpt_bus_register
  
  In xpt_bus_register(), remove superfluous call to free().  This was mostly
  benign since free(9) checks for NULL before doing anything, and
  xpt_create_path() is nice enough to NULL out the pointer on failure.
  However, it could've segfaulted if malloc(9) failed during
  xpt_create_path().
  
  Submitted by:	gibbs
  MFC after:	3 weeks
  Sponsored by:	Spectra Logic Corp

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Wed Nov 15 15:24:28 2017	(r325856)
+++ head/sys/cam/cam_xpt.c	Wed Nov 15 15:52:06 2017	(r325857)
@@ -4049,7 +4049,6 @@ xpt_bus_register(struct cam_sim *sim, device_t parent,
 				  CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
 	if (status != CAM_REQ_CMP) {
 		xpt_release_bus(new_bus);
-		free(path, M_CAMXPT);
 		return (CAM_RESRC_UNAVAIL);
 	}
 


More information about the svn-src-all mailing list