summaryrefslogtreecommitdiff
path: root/sapi/cli/ps_title.c
diff options
context:
space:
mode:
authorKeyur Govande <keyur@php.net>2013-03-29 14:27:36 +0000
committerKeyur Govande <keyur@php.net>2013-03-29 14:27:36 +0000
commit5bf6323e5114646357197a343d202c0f1b8450a1 (patch)
treed28e6596e36e60e4d4ae47369e75afc7c34d4174 /sapi/cli/ps_title.c
parenta0a995cff356a6e7526188ad1979fac6c24b9e7e (diff)
downloadphp-git-5bf6323e5114646357197a343d202c0f1b8450a1.tar.gz
Patch for Bug #64544.
The process title change module keeps track of the locally allocated environ, so it doesn't need to worry about when environ changes underneath it, for example by putenv()/setenv()
Diffstat (limited to 'sapi/cli/ps_title.c')
-rw-r--r--sapi/cli/ps_title.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c
index a2e47f0316..730a31b11e 100644
--- a/sapi/cli/ps_title.c
+++ b/sapi/cli/ps_title.c
@@ -124,6 +124,11 @@ static size_t ps_buffer_cur_len; /* actual string length in ps_buffer */
static int save_argc;
static char** save_argv;
+/*
+ * This holds the 'locally' allocated environ from the save_ps_args method.
+ * This is subsequently free'd at exit.
+ */
+static char** new_environ;
/*
* Call this method early, before any code has used the original argv passed in
@@ -145,7 +150,6 @@ char** save_ps_args(int argc, char** argv)
{
char* end_of_area = NULL;
int non_contiguous_area = 0;
- char** new_environ;
int i;
/*
@@ -405,9 +409,9 @@ void cleanup_ps_args(char **argv)
#ifdef PS_USE_CLOBBER_ARGV
{
int i;
- for (i = 0; environ[i] != NULL; i++)
- free(environ[i]);
- free(environ);
+ for (i = 0; new_environ[i] != NULL; i++)
+ free(new_environ[i]);
+ free(new_environ);
}
#endif /* PS_USE_CLOBBER_ARGV */