From 2d68e8809daa4722a20f9775369ecd35565299dd Mon Sep 17 00:00:00 2001 From: netchild Date: Wed, 15 Mar 2006 19:23:08 +0000 Subject: [PATCH] Fix memory leak introduced in previous revision. Discussed with: phk --- sys/kern/kern_environment.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c index c15e58d43e97..2f9c475b5e65 100644 --- a/sys/kern/kern_environment.c +++ b/sys/kern/kern_environment.c @@ -210,10 +210,10 @@ init_dynamic_kenv(void *data __unused) i = 0; for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) { len = strlen(cp) + 1; - kenvp[i] = malloc(len, M_KENV, M_WAITOK); - if (i < KENV_SIZE) + if (i < KENV_SIZE) { + kenvp[i] = malloc(len, M_KENV, M_WAITOK); strcpy(kenvp[i++], cp); - else + } else printf( "WARNING: too many kenv strings, ignoring %s\n", cp);