0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-10 02:38:42 +00:00

PHP7 adapt: fix zend_string memory leaks

This commit is contained in:
Stefan Siegl 2015-08-30 00:26:55 +02:00
parent 19a67118b5
commit 592d6528ca
3 changed files with 6 additions and 2 deletions

View File

@ -32,7 +32,6 @@ static zval v8js_array_access_dispatch(zend_object *object, const char *method_n
{ {
zend_fcall_info fci; zend_fcall_info fci;
zval php_value; zval php_value;
ZVAL_UNDEF(&php_value);
fci.size = sizeof(fci); fci.size = sizeof(fci);
fci.function_table = &object->ce->function_table; fci.function_table = &object->ce->function_table;
@ -51,6 +50,7 @@ static zval v8js_array_access_dispatch(zend_object *object, const char *method_n
fci.no_separation = 0; fci.no_separation = 0;
zend_call_function(&fci, NULL TSRMLS_CC); zend_call_function(&fci, NULL TSRMLS_CC);
zval_dtor(&fci.function_name);
return php_value; return php_value;
} }
/* }}} */ /* }}} */

View File

@ -48,7 +48,7 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v
max_num_args = method_ptr->common.num_args; max_num_args = method_ptr->common.num_args;
/* Function name to call */ /* Function name to call */
ZVAL_STRING(&fname, ZSTR_VAL(method_ptr->common.function_name)); ZVAL_STR_COPY(&fname, method_ptr->common.function_name);
/* zend_fcall_info */ /* zend_fcall_info */
fci.size = sizeof(fci); fci.size = sizeof(fci);
@ -78,6 +78,7 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v
} }
efree(error); efree(error);
info.GetReturnValue().Set(return_value); info.GetReturnValue().Set(return_value);
zval_dtor(&fname);
return; return;
} }
@ -147,6 +148,7 @@ failure:
return_value = zval_to_v8js(&retval, isolate TSRMLS_CC); return_value = zval_to_v8js(&retval, isolate TSRMLS_CC);
zval_dtor(&retval); zval_dtor(&retval);
zval_dtor(&fname);
info.GetReturnValue().Set(return_value); info.GetReturnValue().Set(return_value);
} }

View File

@ -252,6 +252,8 @@ int v8js_get_properties_hash(v8::Handle<v8::Value> jsValue, HashTable *retval, i
} else { } else {
zend_hash_update(retval, key, &value); zend_hash_update(retval, key, &value);
} }
zend_string_release(key);
} }
return SUCCESS; return SUCCESS;
} }