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
588e28eb
Commit
588e28eb
authored
Sep 24, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3437 from libgit2/cmn/plug-sm
submodule: plug a few leaks
parents
27187344
ab8f2c66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
src/submodule.c
+21
-13
No files found.
src/submodule.c
View file @
588e28eb
...
...
@@ -170,7 +170,7 @@ static int name_from_path(git_buf *out, git_config *cfg, const char *path)
git_buf_clear
(
out
);
git_buf_put
(
out
,
fdot
+
1
,
ldot
-
fdot
-
1
);
return
0
;
goto
cleanup
;
}
if
(
error
==
GIT_ITEROVER
)
{
...
...
@@ -178,6 +178,8 @@ static int name_from_path(git_buf *out, git_config *cfg, const char *path)
error
=
GIT_ENOTFOUND
;
}
cleanup:
git_config_iterator_free
(
iter
);
return
error
;
}
...
...
@@ -1701,7 +1703,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
GITERR_CHECK_ALLOC
(
sm
->
path
);
}
}
else
if
(
error
!=
GIT_ENOTFOUND
)
{
return
error
;
goto
cleanup
;
}
if
((
error
=
get_value
(
&
value
,
cfg
,
&
key
,
sm
->
name
,
"url"
))
==
0
)
{
...
...
@@ -1709,7 +1711,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
sm
->
url
=
git__strdup
(
value
);
GITERR_CHECK_ALLOC
(
sm
->
url
);
}
else
if
(
error
!=
GIT_ENOTFOUND
)
{
return
error
;
goto
cleanup
;
}
if
((
error
=
get_value
(
&
value
,
cfg
,
&
key
,
sm
->
name
,
"branch"
))
==
0
)
{
...
...
@@ -1717,40 +1719,44 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
sm
->
branch
=
git__strdup
(
value
);
GITERR_CHECK_ALLOC
(
sm
->
branch
);
}
else
if
(
error
!=
GIT_ENOTFOUND
)
{
return
error
;
goto
cleanup
;
}
if
((
error
=
get_value
(
&
value
,
cfg
,
&
key
,
sm
->
name
,
"update"
))
==
0
)
{
in_config
=
1
;
if
((
error
=
git_submodule_parse_update
(
&
sm
->
update
,
value
))
<
0
)
return
error
;
goto
cleanup
;
sm
->
update_default
=
sm
->
update
;
}
else
if
(
error
!=
GIT_ENOTFOUND
)
{
return
error
;
goto
cleanup
;
}
if
((
error
=
get_value
(
&
value
,
cfg
,
&
key
,
sm
->
name
,
"fetchRecurseSubmodules"
))
==
0
)
{
in_config
=
1
;
if
((
error
=
git_submodule_parse_recurse
(
&
sm
->
fetch_recurse
,
value
))
<
0
)
return
error
;
goto
cleanup
;
sm
->
fetch_recurse_default
=
sm
->
fetch_recurse
;
}
else
if
(
error
!=
GIT_ENOTFOUND
)
{
return
error
;
goto
cleanup
;
}
if
((
error
=
get_value
(
&
value
,
cfg
,
&
key
,
sm
->
name
,
"ignore"
))
==
0
)
{
in_config
=
1
;
if
((
error
=
git_submodule_parse_ignore
(
&
sm
->
ignore
,
value
))
<
0
)
return
error
;
goto
cleanup
;
sm
->
ignore_default
=
sm
->
ignore
;
}
else
if
(
error
!=
GIT_ENOTFOUND
)
{
return
error
;
goto
cleanup
;
}
if
(
in_config
)
sm
->
flags
|=
GIT_SUBMODULE_STATUS_IN_CONFIG
;
return
0
;
error
=
0
;
cleanup:
git_buf_free
(
&
key
);
return
error
;
}
static
int
submodule_load_each
(
const
git_config_entry
*
entry
,
void
*
payload
)
...
...
@@ -1784,8 +1790,10 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
* already inserted, we've already loaded it, so we skip.
*/
pos
=
git_strmap_lookup_index
(
map
,
name
.
ptr
);
if
(
git_strmap_valid_index
(
map
,
pos
))
return
0
;
if
(
git_strmap_valid_index
(
map
,
pos
))
{
error
=
0
;
goto
done
;
}
if
((
error
=
submodule_alloc
(
&
sm
,
data
->
repo
,
name
.
ptr
))
<
0
)
goto
done
;
...
...
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