aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/symbolic-ref.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-04-07 16:54:08 -0700
committerJunio C Hamano <gitster@pobox.com>2021-04-07 16:54:08 -0700
commit642a40019c99a42f5f4ed4f3e52b9ab92cd75fe7 (patch)
tree03da4a9395b7d4eda1517fb783e246cfeb80c965 /builtin/symbolic-ref.c
parentThe sixth batch (diff)
parenttransport: also free remote_refs in transport_disconnect() (diff)
downloadgit-642a40019c99a42f5f4ed4f3e52b9ab92cd75fe7.tar.gz
git-642a40019c99a42f5f4ed4f3e52b9ab92cd75fe7.zip
Merge branch 'ah/plugleaks'
Plug or annotate remaining leaks that trigger while running the very basic set of tests. * ah/plugleaks: transport: also free remote_refs in transport_disconnect() parse-options: don't leak alias help messages parse-options: convert bitfield values to use binary shift init-db: silence template_dir leak when converting to absolute path init: remove git_init_db_config() while fixing leaks worktree: fix leak in dwim_branch() clone: free or UNLEAK further pointers when finished reset: free instead of leaking unneeded ref symbolic-ref: don't leak shortened refname in check_symref()
Diffstat (limited to 'builtin/symbolic-ref.c')
-rw-r--r--builtin/symbolic-ref.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index 80237f0df1..e547a08d6c 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -24,9 +24,11 @@ static int check_symref(const char *HEAD, int quiet, int shorten, int print)
return 1;
}
if (print) {
+ char *to_free = NULL;
if (shorten)
- refname = shorten_unambiguous_ref(refname, 0);
+ refname = to_free = shorten_unambiguous_ref(refname, 0);
puts(refname);
+ free(to_free);
}
return 0;
}