Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Mar 2017 17:45:00 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315203 - head/sbin/dhclient
Message-ID:  <201703131745.v2DHj0VX067127@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703131745.v2DHj0VX067127>