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
a7d841a8
Unverified
Commit
a7d841a8
authored
Nov 18, 2022
by
Edward Thomson
Committed by
GitHub
Nov 18, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6421 from julianmesa-gitkraken/fix-leak-git_tag_create_from_buffer
Fix leak in git_tag_create_from_buffer
parents
ad2d3a06
25dd1c93
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/libgit2/tag.c
+7
-2
No files found.
src/libgit2/tag.c
View file @
a7d841a8
...
...
@@ -299,8 +299,10 @@ static int git_tag_create__internal(
}
if
(
create_tag_annotation
)
{
if
(
write_tag_annotation
(
oid
,
repo
,
tag_name
,
target
,
tagger
,
message
)
<
0
)
if
(
write_tag_annotation
(
oid
,
repo
,
tag_name
,
target
,
tagger
,
message
)
<
0
)
{
git_str_dispose
(
&
ref_name
);
return
-
1
;
}
}
else
git_oid_cpy
(
oid
,
git_object_id
(
target
));
...
...
@@ -397,14 +399,17 @@ int git_tag_create_from_buffer(git_oid *oid, git_repository *repo, const char *b
/** Ensure the tag name doesn't conflict with an already existing
* reference unless overwriting has explicitly been requested **/
if
(
error
==
0
&&
!
allow_ref_overwrite
)
{
git_str_dispose
(
&
ref_name
);
git_error_set
(
GIT_ERROR_TAG
,
"tag already exists"
);
return
GIT_EEXISTS
;
}
/* write the buffer */
if
((
error
=
git_odb_open_wstream
(
&
stream
,
odb
,
strlen
(
buffer
),
GIT_OBJECT_TAG
))
<
0
)
&
stream
,
odb
,
strlen
(
buffer
),
GIT_OBJECT_TAG
))
<
0
)
{
git_str_dispose
(
&
ref_name
);
return
error
;
}
if
(
!
(
error
=
git_odb_stream_write
(
stream
,
buffer
,
strlen
(
buffer
))))
error
=
git_odb_stream_finalize_write
(
oid
,
stream
);
...
...
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