Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
bd2319c8
Commit
bd2319c8
authored
Jun 17, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1655 from yorah/fix/ref-memleak
ref: free the last ref when cancelling git_branch_foreach()
parents
70587136
2ad7a4dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
5 deletions
+3
-5
src/branch.c
+2
-4
tests-clar/refs/branches/foreach.c
+1
-1
No files found.
src/branch.c
View file @
bd2319c8
...
...
@@ -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
;
}
}
...
...
tests-clar/refs/branches/foreach.c
View file @
bd2319c8
...
...
@@ -122,7 +122,7 @@ void test_refs_branches_foreach__retrieve_remote_symbolic_HEAD_when_present(void
cl_git_pass
(
git_branch_foreach
(
repo
,
GIT_BRANCH_REMOTE
,
contains_branch_list_cb
,
&
exp
));
assert_branch_has_been_found
(
exp
,
"nulltoken/HEAD"
);
assert_branch_has_been_found
(
exp
,
"nulltoken/
HEAD
"
);
assert_branch_has_been_found
(
exp
,
"nulltoken/
master
"
);
}
static
int
branch_list_interrupt_cb
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment