From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 18:23:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C880698; Thu, 23 Oct 2014 18:23:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68FD3BF7; Thu, 23 Oct 2014 18:23:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NINpmP082634; Thu, 23 Oct 2014 18:23:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NINpXD082633; Thu, 23 Oct 2014 18:23:51 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410231823.s9NINpXD082633@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 18:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273552 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 18:23:51 -0000 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); }