svn commit: r315717 - head/usr.sbin/ctm/ctm

Ngie Cooper ngie at FreeBSD.org
Wed Mar 22 17:28:55 UTC 2017


Author: ngie
Date: Wed Mar 22 17:28:53 2017
New Revision: 315717
URL: https://svnweb.freebsd.org/changeset/base/315717

Log:
  ctm: fix memory leaks in Pass1(..)
  
  Call `Delete(..)` (a free(3) wrapper) on `name` when bailing from the
  function.
  
  Submitted by:	Tom Rix <trix at juniper.net>
  Reviewed by:	ngie
  Differential Revision:	D10097
  Sponsored by:	Dell EMC Isilon, Juniper

Modified:
  head/usr.sbin/ctm/ctm/ctm_pass1.c

Modified: head/usr.sbin/ctm/ctm/ctm_pass1.c
==============================================================================
--- head/usr.sbin/ctm/ctm/ctm_pass1.c	Wed Mar 22 17:06:57 2017	(r315716)
+++ head/usr.sbin/ctm/ctm/ctm_pass1.c	Wed Mar 22 17:28:53 2017	(r315717)
@@ -114,6 +114,7 @@ Pass1(FILE *fd, unsigned applied)
 		    }
 		    if (name[0] == '/') {
 			Fatal("Absolute paths are illegal.");
+			Delete(name);
 			return Exit_Mess;
 		    }
 		    q = name;
@@ -121,6 +122,7 @@ Pass1(FILE *fd, unsigned applied)
 			if (q[0] == '.' && q[1] == '.')
 			    if (q[2] == '/' || q[2] == '\0') {
 				Fatal("Paths containing '..' are illegal.");
+				Delete(name);
 				return Exit_Mess;
 			    }
 			if ((q = strchr(q, '/')) == NULL)


More information about the svn-src-head mailing list