examples : fix memory leak on failure to load gpt2 model (#323)

pull/331/head
Andy Maloney 1 year ago committed by GitHub
parent dc90efd504
commit 331c0bbddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -841,6 +841,7 @@ struct gpt2_context * gpt2_init(const char * path_model) {
if (!gpt2_model_load(path_model, ctx->model, ctx->vocab)) {
fprintf(stderr, "%s: failed to load model from '%s'\n", __func__, path_model);
delete ctx;
return nullptr;
}

Loading…
Cancel
Save