Merge branch 'kt/commit-graph-plug-fp-leak-on-error'
Fix a leak of FILE * in an error codepath. * kt/commit-graph-plug-fp-leak-on-error: commit-graph: close file before returning NULL
This commit is contained in:
commit
4c5d5e1b72
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user