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
548cb334
Commit
548cb334
authored
Sep 13, 2015
by
Arthur Schreiber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't free config in `git_transaction_commit`.
The config is not owned by the transaction, so please don’t free it.
parent
1e80bf27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
src/transaction.c
+0
-1
tests/config/write.c
+10
-0
No files found.
src/transaction.c
View file @
548cb334
...
@@ -331,7 +331,6 @@ int git_transaction_commit(git_transaction *tx)
...
@@ -331,7 +331,6 @@ int git_transaction_commit(git_transaction *tx)
if
(
tx
->
type
==
TRANSACTION_CONFIG
)
{
if
(
tx
->
type
==
TRANSACTION_CONFIG
)
{
error
=
git_config_unlock
(
tx
->
cfg
,
true
);
error
=
git_config_unlock
(
tx
->
cfg
,
true
);
git_config_free
(
tx
->
cfg
);
tx
->
cfg
=
NULL
;
tx
->
cfg
=
NULL
;
return
error
;
return
error
;
...
...
tests/config/write.c
View file @
548cb334
...
@@ -670,6 +670,16 @@ void test_config_write__locking(void)
...
@@ -670,6 +670,16 @@ void test_config_write__locking(void)
git_transaction_free
(
tx
);
git_transaction_free
(
tx
);
/* Now that we've unlocked it, we should see both updates */
/* Now that we've unlocked it, we should see both updates */
cl_git_pass
(
git_config_get_entry
(
&
entry
,
cfg
,
"section.name"
));
cl_assert_equal_s
(
"other value"
,
entry
->
value
);
git_config_entry_free
(
entry
);
cl_git_pass
(
git_config_get_entry
(
&
entry
,
cfg
,
"section2.name3"
));
cl_assert_equal_s
(
"more value"
,
entry
->
value
);
git_config_entry_free
(
entry
);
git_config_free
(
cfg
);
/* We should also see the changes after reopening the config */
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
filename
));
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
filename
));
cl_git_pass
(
git_config_get_entry
(
&
entry
,
cfg
,
"section.name"
));
cl_git_pass
(
git_config_get_entry
(
&
entry
,
cfg
,
"section.name"
));
cl_assert_equal_s
(
"other value"
,
entry
->
value
);
cl_assert_equal_s
(
"other value"
,
entry
->
value
);
...
...
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