Skip to content

Commit fd95ecc

Browse files
committed
vad : free memory allocated for VAD hparams
This commit frees the model hyperparameters allocated for the VAD context in the `whisper_vad_free` function. Specifically, it deletes the `encoder_in_channels`, `encoder_out_channels`, and `kernel_sizes` arrays allocated with `new[]` in the `whisper_vad_init` function. The motivation for this is to prevent memory leaks when the VAD. Resolves: #3452
1 parent aeafca4 commit fd95ecc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/whisper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5434,8 +5434,13 @@ void whisper_vad_free(whisper_vad_context * ctx) {
54345434
for (auto & backend : ctx->backends) {
54355435
ggml_backend_free(backend);
54365436
}
5437+
54375438
ggml_free(ctx->ctx);
54385439

5440+
delete[] ctx->model.hparams.encoder_in_channels;
5441+
delete[] ctx->model.hparams.encoder_out_channels;
5442+
delete[] ctx->model.hparams.kernel_sizes;
5443+
54395444
delete ctx;
54405445
}
54415446
}

0 commit comments

Comments
 (0)