* environ.cc (build_env): If realloc moves envblock, move s with it.
This commit is contained in:
parent
ced1e577b7
commit
470e8c460d
|
@ -1,3 +1,7 @@
|
||||||
|
2002-06-14 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* environ.cc (build_env): If realloc moves envblock, move s with it.
|
||||||
|
|
||||||
2002-06-13 Nicholas S. Wourms <nwourms@netscape.net>
|
2002-06-13 Nicholas S. Wourms <nwourms@netscape.net>
|
||||||
|
|
||||||
* winver.rc: Add more words to copyright.
|
* winver.rc: Add more words to copyright.
|
||||||
|
|
|
@ -910,7 +910,16 @@ build_env (const char * const *envp, char *&envblock, int &envc,
|
||||||
|
|
||||||
/* See if we need to increase the size of the block. */
|
/* See if we need to increase the size of the block. */
|
||||||
if (new_tl > tl)
|
if (new_tl > tl)
|
||||||
envblock = (char *) realloc (envblock, 2 + (tl += len + 100));
|
{
|
||||||
|
char *new_envblock =
|
||||||
|
(char *) realloc (envblock, 2 + (tl += len + 100));
|
||||||
|
/* If realloc moves the block, move `s' with it. */
|
||||||
|
if (new_envblock != envblock)
|
||||||
|
{
|
||||||
|
s += new_envblock - envblock;
|
||||||
|
envblock = new_envblock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
memcpy (s, p, len + 1);
|
memcpy (s, p, len + 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue