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
e6d10c58
Commit
e6d10c58
authored
May 08, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pack: make sure not to leak the dep chain
parent
a332e91c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
src/pack.c
+13
-8
No files found.
src/pack.c
View file @
e6d10c58
...
...
@@ -1242,14 +1242,16 @@ static int pack_dependency_chain(git_dependency_chain *chain_out, struct git_pac
curpos
=
obj_offset
;
elem
=
git_array_alloc
(
chain
);
if
(
!
elem
)
return
-
1
;
if
(
!
elem
)
{
error
=
-
1
;
goto
on_error
;
}
error
=
git_packfile_unpack_header
(
&
size
,
&
type
,
&
p
->
mwf
,
&
w_curs
,
&
curpos
);
git_mwindow_close
(
&
w_curs
);
if
(
error
<
0
)
return
error
;
goto
on_
error
;
elem
->
cached
=
0
;
elem
->
offset
=
curpos
;
...
...
@@ -1273,8 +1275,10 @@ static int pack_dependency_chain(git_dependency_chain *chain_out, struct git_pac
if
(
base_offset
==
0
)
return
packfile_error
(
"delta offset is zero"
);
if
(
base_offset
<
0
)
/* must actually be an error code */
return
(
int
)
base_offset
;
if
(
base_offset
<
0
)
{
/* must actually be an error code */
error
=
(
int
)
base_offset
;
goto
on_error
;
}
/* we need to pass the pos *after* the delta-base bit */
elem
->
offset
=
curpos
;
...
...
@@ -1302,9 +1306,10 @@ static int pack_dependency_chain(git_dependency_chain *chain_out, struct git_pac
return
packfile_error
(
"after dependency chain loop; cannot happen"
);
}
if
(
error
<
0
)
git_array_clear
(
chain
);
*
chain_out
=
chain
;
return
error
;
on_error:
git_array_clear
(
chain
);
return
error
;
}
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