Fix a few leaks

This commit is contained in:
Zeev Suraski 1999-08-07 23:04:01 +00:00
parent 7ceaa82d30
commit 720d32f581
3 changed files with 6 additions and 5 deletions

View file

@ -556,6 +556,7 @@ int zendlex(znode *zendlval CLS_DC);
#define PZVAL_LOCK(z) (z)->EA.locks++
#define PZVAL_UNLOCK(z) (z)->EA.locks--
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
#endif /* _COMPILE_H */

View file

@ -36,8 +36,6 @@
#include "zend_extensions.h"
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free ELS_CC)
#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts ELS_CC)
@ -1691,7 +1689,9 @@ send_by_ref:
case ZEND_SWITCH_FREE:
switch (opline->op1.op_type) {
case IS_VAR:
get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
if (!Ts[opline->op1.u.var].var) {
get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
}
FREE_OP(&opline->op1, free_op1);
break;
case IS_TMP_VAR:

View file

@ -205,7 +205,7 @@ ZEND_API inline void safe_free_zval_ptr(zval *p)
ZEND_API int zval_ptr_dtor(zval **zval_ptr)
{
int locked = PZVAL_IS_LOCKED(*zval_ptr);
int locked = (*zval_ptr)->EA.locks;
#if DEBUG_ZEND>=2
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1);
@ -497,7 +497,7 @@ ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **var
if (result && (result->op_type != IS_UNUSED)) {
Ts[result->u.var].var = variable_ptr_ptr;
PZVAL_LOCK(*variable_ptr_ptr);
SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
}
}