whisper: Fix mem leak on failure to load model

pull/318/head
Andy Maloney 3 years ago
parent 4c1fe0c813
commit c088d4abc5

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

Loading…
Cancel
Save