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 <ggerganov@gmail.com>
This commit is contained in:
greeshmay 2022-11-17 12:12:51 -08:00 committed by GitHub
parent e70e5c8b53
commit 2ba66360c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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;
}