cvs: php4 / NEWS /main configuration-parser.y fopen-wrappers.c
| From: | Andi Gutmans | Date: | Thu, 31 Aug 2000 22:23:53 +0000 |
| Subject: | cvs: php4 / NEWS /main configuration-parser.y fopen-wrappers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1480@lists.php.net to get a copy of this message | ||
andi Thu Aug 31 15:23:53 2000 EDT
Modified files:
/php4 NEWS
/php4/main configuration-parser.y fopen-wrappers.c
Log:
- Use emalloc() for opened_path now. This was a potential leak before.
- This patch has potential to break stuff but I tested it as much as I
- could. Fixes should be easy.
Index: php4/NEWS
diff -u php4/NEWS:1.418 php4/NEWS:1.419
--- php4/NEWS:1.418 Thu Aug 31 15:21:47 2000
+++ php4/NEWS Thu Aug 31 15:23:53 2000
@@ -2,6 +2,8 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2000, Version 4.0.3-dev
+- Internal opened_path variable now uses the Zend memory manager so that full
+ paths of files won't leak on unclean shutdown (Andi)
- Removed support of print $obj automatically calling the __string_value()
method. Instead define yourself a method such as toString() and use
print $obj->toString() (Andi, Zend Engine)
Index: php4/main/configuration-parser.y
diff -u php4/main/configuration-parser.y:1.53 php4/main/configuration-parser.y:1.54
--- php4/main/configuration-parser.y:1.53 Tue Jul 25 11:50:50 2000
+++ php4/main/configuration-parser.y Thu Aug 31 15:23:53 2000
@@ -19,7 +19,7 @@
-/* $Id: configuration-parser.y,v 1.53 2000/07/25 18:50:50 stas Exp $ */
+/* $Id: configuration-parser.y,v 1.54 2000/08/31 22:23:53 andi Exp $ */
#define DEBUG_CFG_PARSER 0
#include "php.h"
@@ -223,13 +223,14 @@
if (opened_path) {
zval tmp;
- tmp.value.str.val = opened_path;
+ tmp.value.str.val = strdup(opened_path);
tmp.value.str.len = strlen(opened_path);
tmp.type = IS_STRING;
zend_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void
*) &tmp,sizeof(zval),NULL);
#if DEBUG_CFG_PARSER
php_printf("INI file opened at '%s'\n",opened_path);
#endif
+ efree(opened_path);
}
init_cfg_scanner();
Index: php4/main/fopen-wrappers.c
diff -u php4/main/fopen-wrappers.c:1.85 php4/main/fopen-wrappers.c:1.86
--- php4/main/fopen-wrappers.c:1.85 Thu Aug 31 12:49:36 2000
+++ php4/main/fopen-wrappers.c Thu Aug 31 15:23:53 2000
@@ -16,7 +16,7 @@
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen-wrappers.c,v 1.85 2000/08/31 19:49:36 andi Exp $ */
+/* $Id: fopen-wrappers.c,v 1.86 2000/08/31 22:23:53 andi Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1077,7 +1077,8 @@
memcpy(real_path,new_state.cwd,copy_len);
real_path[copy_len]='\0';
} else {
- real_path = new_state.cwd;
+ real_path = estrndup(new_state.cwd, new_state.cwd_length);
+ free(new_state.cwd);
}
return real_path;