cvs: ZendEngine2 / zend_operators.c
| From: | Dmitry Stogov | Date: | Fri, 07 Oct 2005 10:06:48 +0000 |
| Subject: | cvs: ZendEngine2 / zend_operators.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4216@lists.php.net to get a copy of this message | ||
dmitry Fri Oct 7 06:06:48 2005 EDT
Modified files:
/ZendEngine2 zend_operators.c
Log:
Fixed memory leak
http://cvs.php.net/diff.php/ZendEngine2/zend_operators.c?r1=1.222&r2=1.223&ty=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.222 ZendEngine2/zend_operators.c:1.223
--- ZendEngine2/zend_operators.c:1.222 Wed Oct 5 15:02:27 2005
+++ ZendEngine2/zend_operators.c Fri Oct 7 06:06:45 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_operators.c,v 1.222 2005/10/05 19:02:27 helly Exp $ */
+/* $Id: zend_operators.c,v 1.223 2005/10/07 10:06:45 dmitry Exp $ */
#include <ctype.h>
@@ -319,15 +319,15 @@
#define convert_object_to_type(op, ctype, conv_func) \
if (Z_OBJ_HT_P(op)->cast_object) { \
- zval *org; \
- ALLOC_ZVAL(org); \
- *org = *op; \
- if (Z_OBJ_HT_P(op)->cast_object(org, op, ctype TSRMLS_CC) == FAILURE) { \
+ zval dst; \
+ if (Z_OBJ_HT_P(op)->cast_object(op, &dst, ctype TSRMLS_CC) == FAILURE) { \
zend_error(E_RECOVERABLE_ERROR, \
- "Object of class %v could not be converted to " # ctype, Z_OBJCE_P(org)->name); \
- INIT_ZVAL(*op); \
+ "Object of class %v could not be converted to " # ctype, Z_OBJCE_P(op)->name); \
+ } else { \
+ zval_dtor(op); \
+ op->type = ctype; \
+ op->value = dst.value; \
} \
- zval_dtor(org); \
} else { \
if(Z_OBJ_HT_P(op)->get) { \
zval *newop = Z_OBJ_HT_P(op)->get(op TSRMLS_CC); \