summaryrefslogtreecommitdiff
path: root/processor
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2014-11-13 09:06:20 +0000
committerXuefer <xuefer@gmail.com>2014-11-13 09:06:20 +0000
commit8cc772f85f42e4b44d0ea4e8322b68488825c301 (patch)
treec070093773dd5ddb1974146cce5190a4e09693a1 /processor
parent050f536b175434e15ea2e5728f3f24291f1e4ae3 (diff)
downloadxcache-8cc772f85f42e4b44d0ea4e8322b68488825c301.tar.gz
xcache-8cc772f85f42e4b44d0ea4e8322b68488825c301.zip
cacher: fix more var caching leaks
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1578 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'processor')
-rw-r--r--processor/foot.m45
-rw-r--r--processor/processor.m414
2 files changed, 12 insertions, 7 deletions
diff --git a/processor/foot.m4 b/processor/foot.m4
index 27eef0c..9d1fb29 100644
--- a/processor/foot.m4
+++ b/processor/foot.m4
@@ -141,14 +141,13 @@ EXPORTED_FUNCTION(`void xc_processor_restore_var(zval *dst, zval **dst_ptr, cons
}
}
#endif
- zval_ptr_dtor(&dst);
if (dst_ptr) {
+ zval_ptr_dtor(dst_ptr);
xc_restore_zval_ptr(&processor, dst_ptr, &src->value TSRMLS_CC);
- Z_ADDREF(**dst_ptr);
}
else {
+ zval_dtor(dst);
xc_restore_zval(&processor, dst, src->value TSRMLS_CC);
- Z_ADDREF(*dst);
}
if (processor.handle_reference) {
zend_hash_destroy(&processor.zvalptrs);
diff --git a/processor/processor.m4 b/processor/processor.m4
index 88e4851..2b8f193 100644
--- a/processor/processor.m4
+++ b/processor/processor.m4
@@ -283,9 +283,12 @@ DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
if (zend_hash_find(&processor->zvalptrs, (char *) &SRC()[0], sizeof(SRC()[0]), (void **) &ppzv) == SUCCESS) {
IFCOPY(`
DST()[0] = *ppzv;
- IFSTORE(`Z_ADDREF(**DST());')
+ IFSTORE(`
+ Z_ADDREF(**DST());
+ TRACE("add refcount to %d", Z_REFCOUNT(**DST()));
+ ')
/* *DST() is updated */
- dnl fprintf(stderr, "*DST() is set to %p, PROCESSOR_TYPE is_shm %d\n", (void *) DST()[0], xc_is_shm(DST()[0]));
+ TRACE("*DST() is set to %p, PROCESSOR_TYPE is_shm %d", (void *) DST()[0], xc_is_shm(DST()[0]));
')
IFCALCSTORE(`processor->have_references = 1;')
IFSTORE(`assert(xc_is_shm(DST()[0]));')
@@ -314,12 +317,15 @@ DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
}
')
IFCOPY(`
- dnl fprintf(stderr, "copy from %p to %p\n", SRC()[0], DST()[0]);
+ TRACE("copy from %p to %p", SRC()[0], DST()[0]);
')
IFDPRINT(`INDENT()`'fprintf(stderr, "[%p] ", (void *) SRC()[0]);')
STRUCT_P_EX(zval, DST()[0], SRC()[0], `[0]', `', ` ')
dnl set refcount here instead of struct zval?
- IFSTORE(`Z_SET_REFCOUNT(**DST(), 1);')
+ IFSTORE(`
+ Z_SET_REFCOUNT(**DST(), 1);
+ TRACE("set refcount to %d", Z_REFCOUNT(**DST()));
+ ')
RELOCATE_EX(zval, DST()[0])
} while (0);
')