Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib Remember that we didn't malloc() memory for ...
details: https://anonhg.NetBSD.org/src/rev/874e088a191b
branches: trunk
changeset: 757897:874e088a191b
user: tron <tron%NetBSD.org@localhost>
date: Sat Oct 02 10:05:55 2010 +0000
description:
Remember that we didn't malloc() memory for an environment variable
if it has been set via putenv(3).
diffstat:
lib/libc/stdlib/putenv.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 0453894da8c1 -r 874e088a191b lib/libc/stdlib/putenv.c
--- a/lib/libc/stdlib/putenv.c Sat Oct 02 09:24:16 2010 +0000
+++ b/lib/libc/stdlib/putenv.c Sat Oct 02 10:05:55 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: putenv.c,v 1.13 2010/10/01 20:11:32 christos Exp $ */
+/* $NetBSD: putenv.c,v 1.14 2010/10/02 10:05:55 tron Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)putenv.c 8.2 (Berkeley) 3/27/94";
#else
-__RCSID("$NetBSD: putenv.c,v 1.13 2010/10/01 20:11:32 christos Exp $");
+__RCSID("$NetBSD: putenv.c,v 1.14 2010/10/02 10:05:55 tron Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -72,8 +72,10 @@
if (__allocenv(offset) == -1)
goto bad;
- if (p != NULL && environ[offset] == __environ_malloced[offset])
+ if (p != NULL && environ[offset] == __environ_malloced[offset]) {
free(__environ_malloced[offset]);
+ __environ_malloced[offset] = NULL;
+ }
environ[offset] = str;
rwlock_unlock(&__environ_lock);
Home |
Main Index |
Thread Index |
Old Index