commit-graph: free graph struct that was not added to chain
commit1d94abfe1eedb3f0a9de74ba59483ef8f10b352c
authorJeff King <peff@peff.net>
Tue, 3 Oct 2023 20:30:44 +0000 (3 16:30 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Oct 2023 21:28:24 +0000 (3 14:28 -0700)
treea73a35e31a7abb138bded345b3916c9fb6d6814d
parent991d549f74862d07a38a077f34c0deaf65607c74
commit-graph: free graph struct that was not added to chain

When reading the graph chain file, we open (and allocate) each
individual slice it mentions and then add them to a linked-list chain.
But if adding to the chain fails (e.g., because the base-graph chunk it
contains didn't match what we expected), we leave the function without
freeing the graph struct that caused the failure, leaking it.

We can fix it by calling free_graph_commit().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c