diff options
| author | Patrick Steinhardt <ps@pks.im> | 2018-04-20 21:25:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-20 21:25:01 +0100 |
| commit | 0ad2372b4309f511c48c8e293f1eec396468595a (patch) | |
| tree | 18d037efa435cae592e8360b3a4749cb12e10f02 | |
| parent | 232dd4de169df081d76de623dccb33ee073f60bd (diff) | |
| parent | 25100d6dc964cfb54d38d43a6d3bceae34dcbe36 (diff) | |
| download | libgit2-0ad2372b4309f511c48c8e293f1eec396468595a.tar.gz | |
Merge pull request #4636 from tiennou/fix/leaks
Fix leaks in master
| -rw-r--r-- | src/refspec.c | 5 | ||||
| -rw-r--r-- | tests/worktree/worktree.c | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/refspec.c b/src/refspec.c index 01a77c97f..943a9c76a 100644 --- a/src/refspec.c +++ b/src/refspec.c @@ -304,6 +304,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs) git_buf buf = GIT_BUF_INIT; size_t j, pos; git_remote_head key; + git_refspec *cur; const char* formatters[] = { GIT_REFS_DIR "%s", @@ -312,7 +313,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs) NULL }; - git_refspec *cur = git__calloc(1, sizeof(git_refspec)); + assert(out && spec && refs); + + cur = git__calloc(1, sizeof(git_refspec)); GITERR_CHECK_ALLOC(cur); cur->force = spec->force; diff --git a/tests/worktree/worktree.c b/tests/worktree/worktree.c index 9b932d8ae..c79d97ffa 100644 --- a/tests/worktree/worktree.c +++ b/tests/worktree/worktree.c @@ -300,6 +300,7 @@ void test_worktree_worktree__add_with_explicit_branch(void) git_reference_free(branch); git_reference_free(wthead); git_repository_free(wtrepo); + git_worktree_free(wt); } |
