Skip to content

Commit b5b3d6f

Browse files
authored
ggml : fix minor resource leak reported by static analysis (leejet#237)
1 parent e456108 commit b5b3d6f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ggml.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15446,6 +15446,7 @@ struct ggml_cgraph ggml_graph_import(const char * fname, struct ggml_context **
1544615446

1544715447
if (!*ctx_data) {
1544815448
fprintf(stderr, "%s: failed to create ggml context\n", __func__);
15449+
fclose(fin);
1544915450
return result;
1545015451
}
1545115452
}
@@ -15456,6 +15457,7 @@ struct ggml_cgraph ggml_graph_import(const char * fname, struct ggml_context **
1545615457
const size_t ret = fread(data->data, sizeof(char), fsize, fin);
1545715458
if (ret != fsize) {
1545815459
fprintf(stderr, "%s: failed to read %s\n", __func__, fname);
15460+
fclose(fin);
1545915461
return result;
1546015462
}
1546115463
}

0 commit comments

Comments
 (0)