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
1afad26e
Unverified
Commit
1afad26e
authored
Feb 18, 2022
by
Edward Thomson
Committed by
GitHub
Feb 18, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6219 from apnadkarni/patch-2
Free parent and ref in lg2_commit before returning.
parents
4646f1e3
aab7c0ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
examples/commit.c
+8
-6
No files found.
examples/commit.c
View file @
1afad26e
...
...
@@ -26,7 +26,7 @@
* This does have:
*
* - Example of performing a git commit with a comment
*
*
*/
int
lg2_commit
(
git_repository
*
repo
,
int
argc
,
char
**
argv
)
{
...
...
@@ -36,10 +36,10 @@ int lg2_commit(git_repository *repo, int argc, char **argv)
git_oid
commit_oid
,
tree_oid
;
git_tree
*
tree
;
git_index
*
index
;
git_index
*
index
;
git_object
*
parent
=
NULL
;
git_reference
*
ref
=
NULL
;
git_signature
*
signature
;
git_signature
*
signature
;
/* Validate args */
if
(
argc
<
3
||
strcmp
(
opt
,
"-m"
)
!=
0
)
{
...
...
@@ -62,9 +62,9 @@ int lg2_commit(git_repository *repo, int argc, char **argv)
check_lg2
(
git_index_write
(
index
),
"Could not write index"
,
NULL
);;
check_lg2
(
git_tree_lookup
(
&
tree
,
repo
,
&
tree_oid
),
"Error looking up tree"
,
NULL
);
check_lg2
(
git_signature_default
(
&
signature
,
repo
),
"Error creating signature"
,
NULL
);
check_lg2
(
git_commit_create_v
(
&
commit_oid
,
repo
,
...
...
@@ -78,7 +78,9 @@ int lg2_commit(git_repository *repo, int argc, char **argv)
git_index_free
(
index
);
git_signature_free
(
signature
);
git_tree_free
(
tree
);
git_tree_free
(
tree
);
git_object_free
(
parent
);
git_reference_free
(
ref
);
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