From d8242040b8ee07aebd1f80de6cc23cd3cb825914 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 3 Sep 2000 04:45:52 +0000 Subject: [PATCH] * environ.cc (environ_init): Don't free the new environment table after we've just copied stuff to it. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/environ.cc | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 90c7bea3a..35845b3d9 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Sun Sep 3 00:38:40 2000 Christopher Faylor + + * environ.cc (environ_init): Don't free the new environment table after + we've just copied stuff to it. + Sun Sep 3 00:07:32 2000 Christopher Faylor * Makefile.in: Add cygheap.o. diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 89ad0ab13..2cc8080f7 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; }