mirror of
https://github.com/git/git.git
synced 2024-11-23 09:56:28 +08:00
builtin/diff: free symmetric diff members
We populate a `struct symdiff` in case the user has requested a symmetric diff. Part of this is to populate a `skip` bitmap that indicates which commits shall be ignored in the diff. But while this bitmap is dynamically allocated, we never free it. Fix this by introducing and calling a new `symdiff_release()` function that does this for us. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
36f971f861
commit
77d4b3dd73
@ -388,6 +388,11 @@ static void symdiff_prepare(struct rev_info *rev, struct symdiff *sym)
|
||||
sym->skip = map;
|
||||
}
|
||||
|
||||
static void symdiff_release(struct symdiff *sdiff)
|
||||
{
|
||||
bitmap_free(sdiff->skip);
|
||||
}
|
||||
|
||||
int cmd_diff(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
int i;
|
||||
@ -619,6 +624,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
||||
refresh_index_quietly();
|
||||
release_revisions(&rev);
|
||||
object_array_clear(&ent);
|
||||
symdiff_release(&sdiff);
|
||||
UNLEAK(blob);
|
||||
return result;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ test_description='behavior of diff with symmetric-diff setups and --merge-base'
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
# build these situations:
|
||||
|
@ -5,6 +5,7 @@ test_description='git apply --3way'
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
print_sanitized_conflicted_diff () {
|
||||
|
Loading…
Reference in New Issue
Block a user