mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 12:51:52 +00:00
Merge pull request #415 from stesie/fix-ftbfs-v8-extension
Fix double-free related to std::unique_ptr use
This commit is contained in:
commit
6ab1106201
@ -5,11 +5,11 @@ services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
- V8VER=7.1
|
||||
- V8VER=7.5
|
||||
PHPVER=7.0
|
||||
- V8VER=7.1
|
||||
- V8VER=7.5
|
||||
PHPVER=7.1
|
||||
- V8VER=7.1
|
||||
- V8VER=7.5
|
||||
PHPVER=7.2
|
||||
|
||||
script: make -f Makefile.travis test
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Configure and build scripts for travis CI system
|
||||
V8VER ?= 7.1
|
||||
V8VER ?= 7.5
|
||||
|
||||
IMAGENAME ?= v8js-test
|
||||
|
||||
|
@ -55,7 +55,7 @@ git checkout 6.4.388.18
|
||||
gclient sync
|
||||
|
||||
# Setup GN
|
||||
tools/dev/v8gen.py -vv x64.release -- is_component_build=true
|
||||
tools/dev/v8gen.py -vv x64.release -- is_component_build=true use_custom_libcxx=false
|
||||
|
||||
# Build
|
||||
ninja -C out.gn/x64.release/
|
||||
|
@ -67,7 +67,6 @@ struct v8js_jsext {
|
||||
int deps_count;
|
||||
zend_string *name;
|
||||
zend_string *source;
|
||||
v8::Extension *extension;
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
@ -272,7 +271,6 @@ static void v8js_jsext_free_storage(v8js_jsext *jsext) /* {{{ */
|
||||
if (jsext->deps) {
|
||||
v8js_free_ext_strarr(jsext->deps, jsext->deps_count);
|
||||
}
|
||||
delete jsext->extension;
|
||||
|
||||
// Free the persisted non-interned strings we allocated.
|
||||
if (jsext->name) {
|
||||
@ -1054,7 +1052,7 @@ static int v8js_register_extension(zend_string *name, zend_string *source, zval
|
||||
zend_hash_copy(jsext->deps_ht, Z_ARRVAL_P(deps_arr), v8js_persistent_zval_ctor);
|
||||
}
|
||||
|
||||
jsext->extension = new v8::Extension(ZSTR_VAL(jsext->name), ZSTR_VAL(jsext->source), jsext->deps_count, jsext->deps);
|
||||
v8::Extension *extension = new v8::Extension(ZSTR_VAL(jsext->name), ZSTR_VAL(jsext->source), jsext->deps_count, jsext->deps);
|
||||
|
||||
if (!zend_hash_add_ptr(v8js_process_globals.extensions, jsext->name, jsext)) {
|
||||
v8js_jsext_free_storage(jsext);
|
||||
@ -1068,8 +1066,8 @@ static int v8js_register_extension(zend_string *name, zend_string *source, zval
|
||||
v8js_process_globals.lock.unlock();
|
||||
#endif
|
||||
|
||||
jsext->extension->set_auto_enable(auto_enable ? true : false);
|
||||
v8::RegisterExtension(jsext->extension);
|
||||
extension->set_auto_enable(auto_enable ? true : false);
|
||||
v8::RegisterExtension(std::unique_ptr<v8::Extension>(extension));
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user