Skip to content

Commit 232dd4d

Browse files
authored
Merge pull request libgit2#4635 from tiennou/fix/leaks-v0.27.1
Leak fixes for v0.27.1
2 parents 8d138f8 + df4937b commit 232dd4d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
237237
goto on_error;
238238

239239
/* only write for non-anonymous remotes */
240-
if (name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
240+
if (repo && name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
241241
goto on_error;
242242

243243
if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)

src/transports/local.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,10 @@ static int foreach_reference_cb(git_reference *reference, void *payload)
512512
git_revwalk *walk = (git_revwalk *)payload;
513513
int error;
514514

515-
if (git_reference_type(reference) != GIT_REF_OID)
515+
if (git_reference_type(reference) != GIT_REF_OID) {
516+
git_reference_free(reference);
516517
return 0;
518+
}
517519

518520
error = git_revwalk_hide(walk, git_reference_target(reference));
519521
/* The reference is in the local repository, so the target may not

src/worktree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
131131
goto out;
132132
}
133133

134-
if ((wt = git__calloc(1, sizeof(struct git_repository))) == NULL) {
134+
if ((wt = git__calloc(1, sizeof(*wt))) == NULL) {
135135
error = -1;
136136
goto out;
137137
}

0 commit comments

Comments
 (0)