summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-04 10:21:04 +0900
committerJunio C Hamano <gitster@pobox.com>2017-06-04 10:21:04 +0900
commit34bbe2edd47cf22a7af361f8ec9d41c5ec95aaac (patch)
tree2518c80fab78106a36801c02b6b2a53628fa7c82 /remote.c
parent7ba4fa5c080c3ee2ce2aaafaf469bc781c951571 (diff)
parent443a12f37be1c5967785b83bf04935fe357afb9b (diff)
downloadgit-34bbe2edd47cf22a7af361f8ec9d41c5ec95aaac.tar.gz
Merge branch 'js/plug-leaks' into maint
Fix memory leaks pointed out by Coverity (and people). * js/plug-leaks: (26 commits) checkout: fix memory leak submodule_uses_worktrees(): plug memory leak show_worktree(): plug memory leak name-rev: avoid leaking memory in the `deref` case remote: plug memory leak in match_explicit() add_reflog_for_walk: avoid memory leak shallow: avoid memory leak line-log: avoid memory leak receive-pack: plug memory leak in update() fast-export: avoid leaking memory in handle_tag() mktree: plug memory leaks reported by Coverity pack-redundant: plug memory leak setup_discovered_git_dir(): plug memory leak setup_bare_git_dir(): help static analysis split_commit_in_progress(): simplify & fix memory leak checkout: fix memory leak cat-file: fix memory leak mailinfo & mailsplit: check for EOF while parsing status: close file descriptor after reading git-rebase-todo difftool: address a couple of resource/memory leaks ...
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/remote.c b/remote.c
index 801137c72e..72b4591b98 100644
--- a/remote.c
+++ b/remote.c
@@ -1191,9 +1191,10 @@ static int match_explicit(struct ref *src, struct ref *dst,
else if (is_null_oid(&matched_src->new_oid))
error("unable to delete '%s': remote ref does not exist",
dst_value);
- else if ((dst_guess = guess_ref(dst_value, matched_src)))
+ else if ((dst_guess = guess_ref(dst_value, matched_src))) {
matched_dst = make_linked_ref(dst_guess, dst_tail);
- else
+ free(dst_guess);
+ } else
error("unable to push to unqualified destination: %s\n"
"The destination refspec neither matches an "
"existing ref on the remote nor\n"