]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
whisper : fix mem leak on failure to load model (#318)
authorAndy Maloney <redacted>
Fri, 23 Dec 2022 09:06:17 +0000 (04:06 -0500)
committerGitHub <redacted>
Fri, 23 Dec 2022 09:06:17 +0000 (11:06 +0200)
whisper.cpp

index 367aa2ec195a0fb047c74387fc565a8aa50a6282..3885977d3127c7bd98aab71e5419ec3b1daf164c 100644 (file)
@@ -2235,6 +2235,7 @@ struct whisper_context * whisper_init(const char * path_model) {
 
     if (!whisper_model_load(path_model, *ctx)) {
         fprintf(stderr, "%s: failed to load model from '%s'\n", __func__, path_model);
+        delete ctx;
         return nullptr;
     }