Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2014 18:23:51 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273552 - head/sys/kern
Message-ID:  <201410231823.s9NINpXD082633@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Oct 23 18:23:50 2014
New Revision: 273552
URL: https://svnweb.freebsd.org/changeset/base/273552

Log:
  Test if 'env' is NULL before doing memset() and strlen(),
  the caller may pass NULL to freeenv().

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Thu Oct 23 18:03:27 2014	(r273551)
+++ head/sys/kern/kern_environment.c	Thu Oct 23 18:23:50 2014	(r273552)
@@ -262,7 +262,7 @@ void
 freeenv(char *env)
 {
 
-	if (dynamic_kenv) {
+	if (dynamic_kenv && env != NULL) {
 		memset(env, 0, strlen(env));
 		free(env, M_KENV);
 	}



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