commit-graph: fix memory leak

Free the commit graph when verify_commit_graph_lite() reports an error. Credit to OSS-Fuzz for finding this leak. Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Josh Steadmon committed May 6, 2019 at 14:36 UTC 98552f252ad4a86573d75665fc403f5e66056bb2
1 file changed +3 -1
commit-graph.c
+3 -1
@@ -267,8 +267,10 @@ struct commit_graph *parse_commit_graph(void *graph_map, int fd,
267 last_chunk_offset = chunk_offset;
268 }
269
270 - if (verify_commit_graph_lite(graph))
270 + if (verify_commit_graph_lite(graph)) {
271 + free(graph);
272 return NULL;
273 + }
274
275 return graph;
276 }