1
0
Fork 0

cacher: fix more var caching leaks

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1578 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
master
Xuefer 2014-11-13 09:06:20 +00:00
parent 050f536b17
commit 8cc772f85f
3 changed files with 13 additions and 8 deletions

View File

@ -331,7 +331,7 @@ run() {
;;
esac
"${cmd[@]}" -v || true
#"${cmd[@]}" -v || true
esac
# hack sample.cpp.php {{{1

View File

@ -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);

View File

@ -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);
')