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
c0358ee1
Commit
c0358ee1
authored
Mar 03, 2021
by
panda
Committed by
Edward Thomson
Jun 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check git_signature_dup failure
git_signature_dup can have an allocation failure
parent
5aea17f6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
src/blame.c
+15
-10
No files found.
src/blame.c
View file @
c0358ee1
...
...
@@ -76,6 +76,14 @@ static git_blame_hunk* new_hunk(
return
hunk
;
}
static
void
free_hunk
(
git_blame_hunk
*
hunk
)
{
git__free
((
void
*
)
hunk
->
orig_path
);
git_signature_free
(
hunk
->
final_signature
);
git_signature_free
(
hunk
->
orig_signature
);
git__free
(
hunk
);
}
static
git_blame_hunk
*
dup_hunk
(
git_blame_hunk
*
hunk
)
{
git_blame_hunk
*
newhunk
=
new_hunk
(
...
...
@@ -90,17 +98,14 @@ static git_blame_hunk* dup_hunk(git_blame_hunk *hunk)
git_oid_cpy
(
&
newhunk
->
orig_commit_id
,
&
hunk
->
orig_commit_id
);
git_oid_cpy
(
&
newhunk
->
final_commit_id
,
&
hunk
->
final_commit_id
);
newhunk
->
boundary
=
hunk
->
boundary
;
git_signature_dup
(
&
newhunk
->
final_signature
,
hunk
->
final_signature
);
git_signature_dup
(
&
newhunk
->
orig_signature
,
hunk
->
orig_signature
);
return
newhunk
;
}
static
void
free_hunk
(
git_blame_hunk
*
hunk
)
{
git__free
((
void
*
)
hunk
->
orig_path
);
git_signature_free
(
hunk
->
final_signature
);
git_signature_free
(
hunk
->
orig_signature
);
git__free
(
hunk
);
if
(
git_signature_dup
(
&
newhunk
->
final_signature
,
hunk
->
final_signature
)
<
0
||
git_signature_dup
(
&
newhunk
->
orig_signature
,
hunk
->
orig_signature
)
<
0
)
{
free_hunk
(
newhunk
);
return
NULL
;
}
return
newhunk
;
}
/* Starting with the hunk that includes start_line, shift all following hunks'
...
...
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