svn commit: r315203 - head/sbin/dhclient

Ngie Cooper ngie at FreeBSD.org
Mon Mar 13 17:45:01 UTC 2017


Author: ngie
Date: Mon Mar 13 17:45:00 2017
New Revision: 315203
URL: https://svnweb.freebsd.org/changeset/base/315203

Log:
  sbin/dhclient: fix `vendor` storage leak in parse_option_decl(..)
  
  This ensures the storage isn't leaked when non-NULL and the function
  returns early, prior to the `free(vendor)` later on in the function.
  
  MFC after:	1 week
  Reported by:	Coverity
  CID:		1007111-1007113
  Reviewed by:	cem
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	D9993

Modified:
  head/sbin/dhclient/clparse.c

Modified: head/sbin/dhclient/clparse.c
==============================================================================
--- head/sbin/dhclient/clparse.c	Mon Mar 13 17:35:55 2017	(r315202)
+++ head/sbin/dhclient/clparse.c	Mon Mar 13 17:45:00 2017	(r315203)
@@ -714,6 +714,7 @@ parse_option_decl(FILE *cfile, struct op
 			parse_warn("expecting identifier after '.'");
 			if (token != SEMI)
 				skip_to_semi(cfile);
+			free(vendor);
 			return (NULL);
 		}
 
@@ -726,6 +727,7 @@ parse_option_decl(FILE *cfile, struct op
 		if (!universe) {
 			parse_warn("no vendor named %s.", vendor);
 			skip_to_semi(cfile);
+			free(vendor);
 			return (NULL);
 		}
 	} else {
@@ -747,6 +749,7 @@ parse_option_decl(FILE *cfile, struct op
 			parse_warn("no option named %s for vendor %s",
 				    val, vendor);
 		skip_to_semi(cfile);
+		free(vendor);
 		return (NULL);
 	}
 


More information about the svn-src-head mailing list