mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-29 01:58:47 +01:00
examples : fix memory leak on failure to load gpt2 model (#323)
This commit is contained in:
parent
dc90efd504
commit
331c0bbddc
@ -841,6 +841,7 @@ struct gpt2_context * gpt2_init(const char * path_model) {
|
|||||||
|
|
||||||
if (!gpt2_model_load(path_model, ctx->model, ctx->vocab)) {
|
if (!gpt2_model_load(path_model, ctx->model, ctx->vocab)) {
|
||||||
fprintf(stderr, "%s: failed to load model from '%s'\n", __func__, path_model);
|
fprintf(stderr, "%s: failed to load model from '%s'\n", __func__, path_model);
|
||||||
|
delete ctx;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user