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
65bc26d5
Commit
65bc26d5
authored
May 03, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed last 2 memory leaks in rev-parse.
parent
27ee8483
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/revparse.c
+7
-7
No files found.
src/revparse.c
View file @
65bc26d5
...
...
@@ -238,27 +238,29 @@ static git_object* dereference_object(git_object *obj)
static
int
dereference_to_type
(
git_object
**
out
,
git_object
*
obj
,
git_otype
target_type
)
{
int
retcode
=
1
;
git_object
*
obj1
=
obj
,
*
obj2
=
obj
;
while
(
1
)
{
while
(
retcode
>
0
)
{
git_otype
this_type
=
git_object_type
(
obj1
);
if
(
this_type
==
target_type
)
{
*
out
=
obj1
;
return
0
;
}
retcode
=
0
;
}
else
{
/* Dereference once, if possible. */
obj2
=
dereference_object
(
obj1
);
if
(
!
obj2
)
{
giterr_set
(
GITERR_REFERENCE
,
"Can't dereference to type"
);
return
GIT_ERROR
;
retcode
=
GIT_ERROR
;
}
}
if
(
obj1
!=
obj
)
{
git_object_free
(
obj1
);
}
obj1
=
obj2
;
}
return
retcode
;
}
static
git_otype
parse_obj_type
(
const
char
*
str
)
...
...
@@ -471,10 +473,8 @@ int git_revparse_single(git_object **out, git_repository *repo, const char *spec
}
}
if
(
!
retcode
)
{
if
(
*
out
!=
cur_obj
)
git_object_free
(
cur_obj
);
if
(
*
out
!=
next_obj
&&
next_obj
!=
cur_obj
)
git_object_free
(
next_obj
);
}
git_buf_free
(
&
specbuffer
);
git_buf_free
(
&
stepbuffer
);
...
...
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