diff options
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/commit-graph.c b/commit-graph.c index 441b36016b..06107beedc 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -523,10 +523,13 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, stat_res = stat(chain_name, &st); free(chain_name); - if (!fp || - stat_res || - st.st_size <= the_hash_algo->hexsz) + if (!fp) return NULL; + if (stat_res || + st.st_size <= the_hash_algo->hexsz) { + fclose(fp); + return NULL; + } count = st.st_size / (the_hash_algo->hexsz + 1); CALLOC_ARRAY(oids, count); |