File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ EMSCRIPTEN_BINDINGS(whisper) {
7171 params.print_timestamps = true ;
7272 params.print_special = false ;
7373 params.translate = translate;
74- params.language = whisper_is_multilingual (g_contexts[index]) ? lang.c_str () : " en" ;
74+ params.language = whisper_is_multilingual (g_contexts[index]) ? strdup ( lang.c_str () ) : " en" ;
7575 params.n_threads = std::min (nthreads, std::min (16 , mpow2 (std::thread::hardware_concurrency ())));
7676 params.offset_ms = 0 ;
7777
@@ -106,6 +106,9 @@ EMSCRIPTEN_BINDINGS(whisper) {
106106 whisper_reset_timings (g_contexts[index]);
107107 whisper_full (g_contexts[index], params, pcmf32.data (), pcmf32.size ());
108108 whisper_print_timings (g_contexts[index]);
109+ if (params.language != nullptr && strcmp (params.language , " en" ) != 0 ) {
110+ free ((void *)params.language );
111+ }
109112 });
110113 }
111114
You can’t perform that action at this time.
0 commit comments