Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryorah <yoram.harmelin@gmail.com>2013-06-17 20:25:30 +0400
committeryorah <yoram.harmelin@gmail.com>2013-06-17 20:29:05 +0400
commit2ad7a4dc92a3e604d4ef52899c88c19b4295afa6 (patch)
treeca0e10efedbd4837c1325cf13a59b7f4b24424c1 /src/branch.c
parent705871364bce85f7ef46f7c3f4e680a4591aa304 (diff)
ref: free the last ref when cancelling git_branch_foreach()
Also fixed an assert typo on nulltoken's HEAD
Diffstat (limited to 'src/branch.c')
-rw-r--r--src/branch.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/branch.c b/src/branch.c
index de38e3355..590cdc027 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -132,18 +132,17 @@ int git_branch_foreach(
{
git_reference_iterator *iter;
git_reference *ref;
- int error;
+ int error = 0;
if (git_reference_iterator_new(&iter, repo) < 0)
return -1;
- while ((error = git_reference_next(&ref, iter)) == 0) {
+ while (!error && (error = git_reference_next(&ref, iter)) == 0) {
if (list_flags & GIT_BRANCH_LOCAL &&
git__prefixcmp(ref->name, GIT_REFS_HEADS_DIR) == 0) {
if (callback(ref->name + strlen(GIT_REFS_HEADS_DIR),
GIT_BRANCH_LOCAL, payload)) {
error = GIT_EUSER;
- break;
}
}
@@ -152,7 +151,6 @@ int git_branch_foreach(
if (callback(ref->name + strlen(GIT_REFS_REMOTES_DIR),
GIT_BRANCH_REMOTE, payload)) {
error = GIT_EUSER;
- break;
}
}