Commit: 5bf6323e5114646357197a343d202c0f1b8450a1 Author: Keyur Govande <ke...@php.net> Fri, 29 Mar 2013 14:27:36 +0000 Parents: a0a995cff356a6e7526188ad1979fac6c24b9e7e Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5bf6323e5114646357197a343d202c0f1b8450a1 Log: 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() Bugs: https://bugs.php.net/64544 Changed paths: M sapi/cli/php_cli.c M sapi/cli/ps_title.c Diff: diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 4b8bae7..7290523 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 a2e47f0..730a31b 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 */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php