Skip to content

Commit 0ad2372

Browse files
authored
Merge pull request libgit2#4636 from tiennou/fix/leaks
Fix leaks in master
2 parents 232dd4d + 25100d6 commit 0ad2372

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/refspec.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
304304
git_buf buf = GIT_BUF_INIT;
305305
size_t j, pos;
306306
git_remote_head key;
307+
git_refspec *cur;
307308

308309
const char* formatters[] = {
309310
GIT_REFS_DIR "%s",
@@ -312,7 +313,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
312313
NULL
313314
};
314315

315-
git_refspec *cur = git__calloc(1, sizeof(git_refspec));
316+
assert(out && spec && refs);
317+
318+
cur = git__calloc(1, sizeof(git_refspec));
316319
GITERR_CHECK_ALLOC(cur);
317320

318321
cur->force = spec->force;

tests/worktree/worktree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ void test_worktree_worktree__add_with_explicit_branch(void)
300300
git_reference_free(branch);
301301
git_reference_free(wthead);
302302
git_repository_free(wtrepo);
303+
git_worktree_free(wt);
303304
}
304305

305306

0 commit comments

Comments
 (0)