]> git.ipfire.org Git - thirdparty/git.git/commit
commit-graph: avoid memory leaks
authorJonathan Tan <jonathantanmy@google.com>
Mon, 4 May 2020 19:13:24 +0000 (12:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 May 2020 21:08:38 +0000 (14:08 -0700)
commitfbda77c6c00a7cec65c4f266b09252df73a9deff
treef36de609ab516a9651fec7f7fdc94d04eb438546
parentcaf388caa101be90b7ec43d7f78ca4e935fc0150
commit-graph: avoid memory leaks

A fuzzer running on the entry point provided by fuzz-commit-graph.c
revealed a memory leak when parse_commit_graph() creates a struct
bloom_filter_settings and then returns early due to error. Fix that
error by always freeing that struct first (if it exists) before
returning early due to error.

While making that change, I also noticed another possible memory leak -
when the BLOOMDATA chunk is provided but not BLOOMINDEXES. Also fix that
error.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c