svn commit: r273472 - head/sys/x86/xen

Roger Pau Monné royger at FreeBSD.org
Wed Oct 22 16:49:01 UTC 2014


Author: royger
Date: Wed Oct 22 16:49:00 2014
New Revision: 273472
URL: https://svnweb.freebsd.org/changeset/base/273472

Log:
  xen: fix usage of kern_getenv in PVH code
  
  The value returned by kern_getenv should be freed using freeenv.
  
  Reported by:	Coverity
  CID:		1248852
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/x86/xen/pv.c

Modified: head/sys/x86/xen/pv.c
==============================================================================
--- head/sys/x86/xen/pv.c	Wed Oct 22 13:50:38 2014	(r273471)
+++ head/sys/x86/xen/pv.c	Wed Oct 22 16:49:00 2014	(r273472)
@@ -306,11 +306,14 @@ static void
 xen_pv_set_boothowto(void)
 {
 	int i;
+	char *env;
 
 	/* get equivalents from the environment */
 	for (i = 0; howto_names[i].ev != NULL; i++) {
-		if (kern_getenv(howto_names[i].ev) != NULL)
+		if ((env = kern_getenv(howto_names[i].ev)) != NULL) {
 			boothowto |= howto_names[i].mask;
+			freeenv(env);
+		}
 	}
 }
 


More information about the svn-src-head mailing list