summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-20 20:27:20 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-20 11:36:13 -0700
commite5fb028688f5811bd835c0bc47f8d7a379a0d152 (patch)
treea9e8e75d8139818d8f39240d5ef5bb9ce27ac179 /builtin
parenttag: use a "goto cleanup" pattern, leak less memory (diff)
downloadtgif-e5fb028688f5811bd835c0bc47f8d7a379a0d152.tar.xz
ref-filter API user: add and use a ref_sorting_release()
Add a ref_sorting_release() and use it for some of the current API users, the ref_sorting_default() function and its siblings will do a malloc() which wasn't being free'd previously. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/for-each-ref.c2
-rw-r--r--builtin/tag.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 642b4b888f..16a2c7d57c 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -96,6 +96,6 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
ref_array_clear(&array);
free_commit_list(filter.with_commit);
free_commit_list(filter.no_commit);
- UNLEAK(sorting);
+ ref_sorting_release(sorting);
return 0;
}
diff --git a/builtin/tag.c b/builtin/tag.c
index ad6c985591..6fe646710d 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -630,6 +630,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
find_unique_abbrev(&prev, DEFAULT_ABBREV));
cleanup:
+ ref_sorting_release(sorting);
strbuf_release(&buf);
strbuf_release(&ref);
strbuf_release(&reflog_msg);