]> git.99rst.org Git - git.git/commitdiff
ref-filter.c: fix a leak in get_head_description
authorRubén Justo <redacted>
Sat, 24 Sep 2022 22:53:18 +0000 (00:53 +0200)
committerJunio C Hamano <redacted>
Mon, 26 Sep 2022 18:14:49 +0000 (11:14 -0700)
In 2708ce62d2 (branch: sort detached HEAD based on a flag, 2021-01-07) a
call to wt_status_state_free_buffers, responsible of freeing the
resources that could be allocated in the local struct wt_status_state
state, was eliminated.

The call to wt_status_state_free_buffers was introduced in 962dd7ebc3
(wt-status: introduce wt_status_state_free_buffers(), 2020-09-27).  This
commit brings back that call in get_head_description.

Signed-off-by: Rubén Justo <redacted>
Reviewed-by: Martin Ågren <redacted>
Acked-by: Ævar Arnfjörð Bjarmason <redacted>
Signed-off-by: Junio C Hamano <redacted>
ref-filter.c

index f0bd32f714168d03394a3313c1ac6af196d5202f..bc4d2e7daced36e867bb62b18b662a992440f761 100644 (file)
@@ -1571,6 +1571,8 @@ char *get_head_description(void)
        } else
                strbuf_addstr(&desc, _("(no branch)"));
 
+       wt_status_state_free_buffers(&state);
+
        return strbuf_detach(&desc, NULL);
 }
 
git clone https://git.99rst.org/PROJECT