1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 04:49:43 +01:00

config: fix leaking "core.notesref" variable

The variable used to track the "core.notesref" config is not getting
freed before we assign to it and thus leaks. Fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-06-11 11:20:38 +02:00 committed by Junio C Hamano
parent f46ede661f
commit c6eb58bfb1
3 changed files with 3 additions and 0 deletions

View file

@ -1565,6 +1565,7 @@ static int git_default_core_config(const char *var, const char *value,
if (!strcmp(var, "core.notesref")) {
if (!value)
return config_error_nonbool(var);
free(notes_ref_name);
notes_ref_name = xstrdup(value);
return 0;
}

View file

@ -5,6 +5,7 @@
test_description='Test merging of notes trees'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '

View file

@ -5,6 +5,7 @@
test_description='Test notes merging with auto-resolving strategies'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Set up a notes merge scenario with all kinds of potential conflicts