summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/setenv.c
diff options
context:
space:
mode:
authortron <tron@NetBSD.org>2010-09-25 19:10:37 +0000
committertron <tron@NetBSD.org>2010-09-25 19:10:37 +0000
commited5e497e600f0b32fda4c406de9147308cb04aec (patch)
tree24d3c929bd46f957d2e3301f6543d406dc11eb1a /lib/libc/stdlib/setenv.c
parent1f5de17d4a45553fc1670c7dd6a575408e594a73 (diff)
Remember the correct pointer which we will free later.
Diffstat (limited to 'lib/libc/stdlib/setenv.c')
-rw-r--r--lib/libc/stdlib/setenv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/setenv.c b/lib/libc/stdlib/setenv.c
index 07e8ff4866b..0b2d4865285 100644
--- a/lib/libc/stdlib/setenv.c
+++ b/lib/libc/stdlib/setenv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: setenv.c,v 1.36 2010/09/25 18:11:40 tron Exp $ */
+/* $NetBSD: setenv.c,v 1.37 2010/09/25 19:10:37 tron Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setenv.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: setenv.c,v 1.36 2010/09/25 18:11:40 tron Exp $");
+__RCSID("$NetBSD: setenv.c,v 1.37 2010/09/25 19:10:37 tron Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -118,7 +118,7 @@ setenv(const char *name, const char *value, int rewrite)
*c++ = '=';
free(__environ_malloced[offset]);
- __environ_malloced[offset] = c;
+ __environ_malloced[offset] = environ[offset];
copy:
(void)memcpy(c, value, l_value + 1);