diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-02-07 00:07:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-06 15:34:38 -0800 |
commit | 9f24f3c719ccb4553f97a861c37cbedcc7357762 (patch) | |
tree | 6539f045cfd6ee814ab92a03e68af8999c13eba4 /http-backend.c | |
parent | 90428ddccf7bc0c0c192fc973b2d1a7a47605e10 (diff) | |
download | git-9f24f3c719ccb4553f97a861c37cbedcc7357762.tar.gz |
worktree: fix a trivial leak in prune_worktrees()
We were leaking both the "struct strbuf" in prune_worktrees(), as well
as the "path" we got from should_prune_worktree(). Since these were
the only two uses of the "struct string_list" let's change it to a
"DUP" and push these to it with "string_list_append_nodup()".
For the string_list_append_nodup() we could also string_list_append()
the main_path.buf, and then strbuf_release(&main_path) right away. But
doing it this way avoids an allocation, as we already have the "struct
strbuf" prepared for appending to "kept".
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-backend.c')
0 files changed, 0 insertions, 0 deletions