From: Josh Steadmon Date: Mon, 6 May 2019 21:36:58 +0000 (-0700) Subject: commit-graph: fix memory leak X-Git-Tag: v2.22.0-rc1~27^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/98552f252ad4a86573d75665fc403f5e66056bb2?ds=sidebyside 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 Signed-off-by: Junio C Hamano --- diff --git a/commit-graph.c b/commit-graph.c index 66865acbd7..4bce70d35c 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -267,8 +267,10 @@ struct commit_graph *parse_commit_graph(void *graph_map, int fd, last_chunk_offset = chunk_offset; } - if (verify_commit_graph_lite(graph)) + if (verify_commit_graph_lite(graph)) { + free(graph); return NULL; + } return graph; }