[memory leakage] fixed a leakage by projector free

This commit is contained in:
李为 2024-11-14 08:32:55 +08:00
parent 98297afbd5
commit fc25544867

View file

@ -18,6 +18,7 @@
#include <thread> #include <thread>
#include <vector> #include <vector>
#include <cstring> #include <cstring>
#include <iostream>
// //
// Constants // Constants
@ -708,6 +709,7 @@ void omni_free(struct omni_context *ctx_omni)
if(internal_chars != nullptr) if(internal_chars != nullptr)
{ {
free(internal_chars); free(internal_chars);
internal_chars = nullptr;
} }
if (ctx_omni->ctx_whisper) if (ctx_omni->ctx_whisper)
{ {
@ -716,7 +718,7 @@ void omni_free(struct omni_context *ctx_omni)
} }
if (ctx_omni->projector) if (ctx_omni->projector)
{ {
ctx_omni->projector->free(); delete ctx_omni->projector;
} }
llama_free(ctx_omni->ctx_llama); llama_free(ctx_omni->ctx_llama);