mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-06-16 05:48:09 +00:00
whisper : fix mem leak on failure to load model (#318)
This commit is contained in:
@ -2235,6 +2235,7 @@ struct whisper_context * whisper_init(const char * path_model) {
|
|||||||
|
|
||||||
if (!whisper_model_load(path_model, *ctx)) {
|
if (!whisper_model_load(path_model, *ctx)) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user