]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10488: [mod_v8] Fix memory leak.
authorAndrey Volk <andywolk@gmail.com>
Tue, 11 Jul 2017 18:34:45 +0000 (21:34 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 11 Jul 2017 18:34:45 +0000 (21:34 +0300)
src/mod/languages/mod_v8/mod_v8.cpp

index 6523051de8f67bed9a3552c97947d1ffa3c7804f..bd3882d0d891e1c9a6038572d64b85db106b46ae 100644 (file)
@@ -655,7 +655,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
                                                }
                                                // Create a string containing the JavaScript source code.
 #if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >=5
-                                               ScriptCompiler::Source *source = new ScriptCompiler::Source(String::NewFromUtf8(isolate, script_data));
+                                               ScriptCompiler::Source source(String::NewFromUtf8(isolate, script_data));
 #else
                                                Handle<String> source = String::NewFromUtf8(isolate, script_data);
 #endif
@@ -665,7 +665,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
                                                // Compile the source code.
 #if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >=5
                                                v8::ScriptCompiler::CompileOptions options = v8::ScriptCompiler::kNoCompileOptions;
-                                               Handle<v8::Script> v8_script = v8::ScriptCompiler::Compile(context, source, options).ToLocalChecked();
+                                               Handle<v8::Script> v8_script = v8::ScriptCompiler::Compile(context, &source, options).ToLocalChecked();
                                                //Handle<v8::Script> v8_script = v8::ScriptCompiler::Compile(context, source,/* String::NewFromUtf8(isolate, script_file),*/ v8::ScriptCompiler::kProduceCodeCache).ToLocalChecked();
                                                //source->GetCachedData();
 #else