Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Oct 2014 16:49:01 +0000 (UTC)
From:      Roger Pau Monné <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273472 - head/sys/x86/xen
Message-ID:  <201410221649.s9MGn1Sf050311@svn.freebsd.org>

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



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