summaryrefslogtreecommitdiff
path: root/builtin/show-branch.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2023-02-07 00:07:47 +0100
committerJunio C Hamano <gitster@pobox.com>2023-02-06 15:34:39 -0800
commit81559612a94636f1efe8268385fe6a4ab182ac19 (patch)
treeba5587d6aa6c80db56f3593445d833e945569b77 /builtin/show-branch.c
parent9d01cfed6915b1e99c266fd578e39c7aba7767dc (diff)
downloadgit-81559612a94636f1efe8268385fe6a4ab182ac19.tar.gz
show-branch: free() allocated "head" before return
Stop leaking the "head" variable, which we've been leaking since it was originally added in [1], and in its current form since [2] 1. ed378ec7e85 (Make ref resolution saner, 2006-09-11) 2. d9e557a320b (show-branch: store resolved head in heap buffer, 2017-02-14). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/show-branch.c')
-rw-r--r--builtin/show-branch.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index c013abaf94..358ac3e519 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -956,5 +956,6 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
if (shown_merge_point && --extra < 0)
break;
}
+ free(head);
return 0;
}