Skip to content

Commit 98552f2

Browse files
steadmongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 83232e3 commit 98552f2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

commit-graph.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ struct commit_graph *parse_commit_graph(void *graph_map, int fd,
267267
last_chunk_offset = chunk_offset;
268268
}
269269

270-
if (verify_commit_graph_lite(graph))
270+
if (verify_commit_graph_lite(graph)) {
271+
free(graph);
271272
return NULL;
273+
}
272274

273275
return graph;
274276
}

0 commit comments

Comments
 (0)