Merge pull request #33 from sgolemon/object.alloc

Fix allocation of lua object.
This commit is contained in:
Xinchen Hui
2017-10-18 12:55:49 +08:00
committed by GitHub

7
lua.c
View File

@@ -197,12 +197,7 @@ zend_object *php_lua_create_object(zend_class_entry *ce)
lua_atpanic(L, php_lua_atpanic);
intern = emalloc(sizeof(php_lua_object) + sizeof(zval) * (ce->default_properties_count - 1));
if (!intern) {
php_error_docref(NULL, E_ERROR, "alloc memory for lua object failed");
}
intern = ecalloc(1, sizeof(php_lua_object) + zend_object_properties_size(ce));
intern->L = L;
zend_object_std_init(&intern->obj, ce);