From: Cristiano Calcagno Date: Sun, 18 Jun 2023 07:45:11 +0000 (+0200) Subject: ggml : fix minor resource leak reported by static analysis (#237) X-Git-Tag: upstream/0.0.1642~1408 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=b5b3d6f9ded894f00b3e951413a8bab6fb0f95d7;p=pkg%2Fggml%2Fsources%2Fggml ggml : fix minor resource leak reported by static analysis (#237) --- diff --git a/src/ggml.c b/src/ggml.c index e1a95600..467b7289 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -15446,6 +15446,7 @@ struct ggml_cgraph ggml_graph_import(const char * fname, struct ggml_context ** if (!*ctx_data) { fprintf(stderr, "%s: failed to create ggml context\n", __func__); + fclose(fin); return result; } } @@ -15456,6 +15457,7 @@ struct ggml_cgraph ggml_graph_import(const char * fname, struct ggml_context ** const size_t ret = fread(data->data, sizeof(char), fsize, fin); if (ret != fsize) { fprintf(stderr, "%s: failed to read %s\n", __func__, fname); + fclose(fin); return result; } }