cvs: ZendEngine2 / zend_API.c
[email protected] ("Antony Dovgal")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvstony20011201991366@cvsserver> |
tony2001 Sat Feb 2 22:29:26 2008 UTC
Modified files:
/ZendEngine2 zend_API.c
Log:
fix leak appearing when calling non-static protected or private methods as static
(error message is allocated twice)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.455&r2=1.456&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.455 ZendEngine2/zend_API.c:1.456
--- ZendEngine2/zend_API.c:1.455 Sat Feb 2 15:46:19 2008
+++ ZendEngine2/zend_API.c Sat Feb 2 22:29:26 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.455 2008/02/02 15:46:19 helly Exp $ */
+/* $Id: zend_API.c,v 1.456 2008/02/02 22:29:26 tony2001 Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -2652,6 +2652,10 @@
zend_function *fptr;
HashTable *ftable;
+ if (error) {
+ *error = NULL;
+ }
+
*ce_ptr = NULL;
*fptr_ptr = NULL;
@@ -2792,12 +2796,22 @@
if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
if (fptr->op_array.fn_flags & ZEND_ACC_PRIVATE) {
if (!zend_check_private(fptr, *zobj_ptr_ptr ? Z_OBJCE_PP(*zobj_ptr_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
- if (error) zend_spprintf(error, 0, "cannot access private method %s::%s()", (*ce_ptr)->name, fptr->common.function_name);
+ if (error) {
+ if (*error) {
+ efree(*error);
+ }
+ zend_spprintf(error, 0, "cannot access private method %s::%s()", (*ce_ptr)->name, fptr->common.function_name);
+ }
retval = 0;
}
} else if ((fptr->common.fn_flags & ZEND_ACC_PROTECTED)) {
if (!zend_check_protected(fptr->common.scope, EG(scope))) {
- if (error) zend_spprintf(error, 0, "cannot access protected method %s::%s()", (*ce_ptr)->name, fptr->common.function_name);
+ if (error) {
+ if (*error) {
+ efree(*error);
+ }
+ zend_spprintf(error, 0, "cannot access protected method %s::%s()", (*ce_ptr)->name, fptr->common.function_name);
+ }
retval = 0;
}
}