aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/environ.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-09-03 04:45:52 +0000
committerChristopher Faylor <me@cgf.cx>2000-09-03 04:45:52 +0000
commitd8242040b8ee07aebd1f80de6cc23cd3cb825914 (patch)
treee8a1c2785301be321979aac6b3e5b99ba3322070 /winsup/cygwin/environ.cc
parentb0e82b74fbdfa2dee89505aba03f2827480cc8ca (diff)
downloadnewlib-d8242040b8ee07aebd1f80de6cc23cd3cb825914.zip
newlib-d8242040b8ee07aebd1f80de6cc23cd3cb825914.tar.gz
newlib-d8242040b8ee07aebd1f80de6cc23cd3cb825914.tar.bz2
* environ.cc (environ_init): Don't free the new environment table after we've
just copied stuff to it.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 89ad0ab..2cc8080 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -19,6 +19,7 @@ details. */
#include "fhandler.h"
#include "path.h"
#include "cygerrno.h"
+#include "cygheap.h"
extern BOOL allow_glob;
extern BOOL allow_ntea;
@@ -535,8 +536,9 @@ environ_init (char **envp)
{
sz = envsize (envp, 1);
char **newenv = (char **) malloc (sz);
- envp = (char **) memcpy (newenv, envp, sz);
+ memcpy (newenv, envp, sz);
cfree (envp);
+ envp = newenv;
goto out;
}