]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
fix: free ggml_context (close #149) (#150)
authorgreeshmay <redacted>
Thu, 17 Nov 2022 20:12:51 +0000 (12:12 -0800)
committerGitHub <redacted>
Thu, 17 Nov 2022 20:12:51 +0000 (22:12 +0200)
* fix: free ggml_context

* ggml : free the model's contexts in whisper_free()

Co-authored-by: Georgi Gerganov <redacted>
whisper.cpp

index d894f69cd45932a2417d7384f3b545a8329359b9..a8b9e7149cd81e6478e3151a3e1b394f31e277d9 100644 (file)
@@ -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;
         }