Test if 'env' is NULL before doing memset() and strlen(),

the caller may pass NULL to freeenv().
This commit is contained in:
Xin LI 2014-10-23 18:23:50 +00:00
parent bdb4291f89
commit 2735a91d93

View File

@ -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);
}