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
4dbcf0e6
Commit
4dbcf0e6
authored
May 01, 2017
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote: free the config snapshot
This reverts commit
55522376
and frees the snapshot properly.
parent
be343b88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
src/remote.c
+8
-8
No files found.
src/remote.c
View file @
4dbcf0e6
...
...
@@ -192,7 +192,7 @@ static int canonicalize_url(git_buf *out, const char *in)
static
int
create_internal
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
const
char
*
fetch
)
{
git_remote
*
remote
;
git_config
*
config
=
NULL
;
git_config
*
config
_ro
=
NULL
,
*
config_rw
;
git_buf
canonical_url
=
GIT_BUF_INIT
;
git_buf
var
=
GIT_BUF_INIT
;
int
error
=
-
1
;
...
...
@@ -200,7 +200,7 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
/* name is optional */
assert
(
out
&&
repo
&&
url
);
if
((
error
=
git_repository_config_
_weakptr
(
&
config
,
repo
))
<
0
)
if
((
error
=
git_repository_config_
snapshot
(
&
config_ro
,
repo
))
<
0
)
return
error
;
remote
=
git__calloc
(
1
,
sizeof
(
git_remote
));
...
...
@@ -212,7 +212,8 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
(
error
=
canonicalize_url
(
&
canonical_url
,
url
))
<
0
)
goto
on_error
;
remote
->
url
=
apply_insteadof
(
repo
->
_config
,
canonical_url
.
ptr
,
GIT_DIRECTION_FETCH
);
remote
->
url
=
apply_insteadof
(
config_ro
,
canonical_url
.
ptr
,
GIT_DIRECTION_FETCH
);
GITERR_CHECK_ALLOC
(
remote
->
url
);
if
(
name
!=
NULL
)
{
remote
->
name
=
git__strdup
(
name
);
...
...
@@ -221,7 +222,8 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
if
((
error
=
git_buf_printf
(
&
var
,
CONFIG_URL_FMT
,
name
))
<
0
)
goto
on_error
;
if
((
error
=
git_config_set_string
(
config
,
var
.
ptr
,
canonical_url
.
ptr
))
<
0
)
if
((
error
=
git_repository_config__weakptr
(
&
config_rw
,
repo
))
<
0
||
(
error
=
git_config_set_string
(
config_rw
,
var
.
ptr
,
canonical_url
.
ptr
))
<
0
)
goto
on_error
;
}
...
...
@@ -233,10 +235,7 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
if
(
name
&&
(
error
=
write_add_refspec
(
repo
,
name
,
fetch
,
true
))
<
0
)
goto
on_error
;
if
((
error
=
git_repository_config_snapshot
(
&
config
,
repo
))
<
0
)
goto
on_error
;
if
((
error
=
lookup_remote_prune_config
(
remote
,
config
,
name
))
<
0
)
if
((
error
=
lookup_remote_prune_config
(
remote
,
config_ro
,
name
))
<
0
)
goto
on_error
;
/* Move the data over to where the matching functions can find them */
...
...
@@ -260,6 +259,7 @@ on_error:
if
(
error
)
git_remote_free
(
remote
);
git_config_free
(
config_ro
);
git_buf_free
(
&
canonical_url
);
git_buf_free
(
&
var
);
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