From: greeshmay Date: Thu, 17 Nov 2022 20:12:51 +0000 (-0800) Subject: fix: free ggml_context (close #149) (#150) X-Git-Tag: upstream/1.7.4~1829 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=2ba66360c9c999be108a6d08ec8032b310220b31;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp fix: free ggml_context (close #149) (#150) * fix: free ggml_context * ggml : free the model's contexts in whisper_free() Co-authored-by: Georgi Gerganov --- diff --git a/whisper.cpp b/whisper.cpp index d894f69c..a8b9e714 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2169,6 +2169,12 @@ struct whisper_context * whisper_init(const char * path_model) { void whisper_free(struct whisper_context * ctx) { if (ctx) { + if (ctx->model.ctx) { + ggml_free(ctx->model.ctx); + } + if (ctx->model.ctx_mem) { + ggml_free(ctx->model.ctx_mem); + } if (ctx->buf_model) { delete ctx->buf_model; }