mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 18:41:52 +00:00
Fix use-after-free on module reuse
This commit is contained in:
parent
d8e239a756
commit
2ce7e420a7
@ -254,12 +254,13 @@ V8JS_METHOD(require)
|
|||||||
|
|
||||||
// If we have already loaded and cached this module then use it
|
// If we have already loaded and cached this module then use it
|
||||||
if (c->modules_loaded.count(normalised_module_id) > 0) {
|
if (c->modules_loaded.count(normalised_module_id) > 0) {
|
||||||
efree(normalised_module_id);
|
|
||||||
efree(normalised_path);
|
|
||||||
|
|
||||||
v8::Persistent<v8::Object> newobj;
|
v8::Persistent<v8::Object> newobj;
|
||||||
newobj.Reset(isolate, c->modules_loaded[normalised_module_id]);
|
newobj.Reset(isolate, c->modules_loaded[normalised_module_id]);
|
||||||
info.GetReturnValue().Set(newobj);
|
info.GetReturnValue().Set(newobj);
|
||||||
|
|
||||||
|
efree(normalised_module_id);
|
||||||
|
efree(normalised_path);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user