From d6c7850afad1e3ac7ac6a48c91251f220d6312a1 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Mon, 2 Oct 2017 18:46:17 -0400 Subject: [PATCH] Explicitly release held references to PHP callbacks --- lua.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lua.c b/lua.c index d5f4acd..e44a990 100755 --- a/lua.c +++ b/lua.c @@ -63,6 +63,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_lua_free, 0, 0, 1) ZEND_END_ARG_INFO() /* }}} */ +static PHP_RSHUTDOWN_FUNCTION(lua) /* {{{ */ +{ + zval *callbacks = zend_read_static_property(lua_ce, ZEND_STRL("_callbacks"), 1); + + if (callbacks) { + zval_ptr_dtor(callbacks); + } + + return SUCCESS; +} +/* }}} */ + + /* {{{ lua_module_entry */ zend_module_entry lua_module_entry = { @@ -74,7 +87,7 @@ zend_module_entry lua_module_entry = { PHP_MINIT(lua), PHP_MSHUTDOWN(lua), NULL, - NULL, + PHP_RSHUTDOWN(lua), PHP_MINFO(lua), #if ZEND_MODULE_API_NO >= 20010901 PHP_LUA_VERSION,