summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sapi/cli/php_cli.c2
-rw-r--r--sapi/cli/ps_title.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 4b8bae7f78..729052334d 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1402,7 +1402,7 @@ out:
* Do not move this de-initialization. It needs to happen right before
* exiting.
*/
- cleanup_ps_args(argv);
+ cleanup_ps_args(argv);
exit(exit_status);
}
/* }}} */
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 */