0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 14:01:53 +00:00

Fix use-after-free on module reuse

This commit is contained in:
Stefan Siegl 2015-08-01 18:11:39 +02:00
parent d8e239a756
commit 2ce7e420a7

View File

@ -254,12 +254,13 @@ V8JS_METHOD(require)
// If we have already loaded and cached this module then use it
if (c->modules_loaded.count(normalised_module_id) > 0) {
efree(normalised_module_id);
efree(normalised_path);
v8::Persistent<v8::Object> newobj;
newobj.Reset(isolate, c->modules_loaded[normalised_module_id]);
info.GetReturnValue().Set(newobj);
efree(normalised_module_id);
efree(normalised_path);
return;
}