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
da04d3fc
Commit
da04d3fc
authored
Aug 02, 2022
by
yuangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix grafts and shallowarray memory leaks
parent
e93d0815
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
14 deletions
+10
-14
src/libgit2/grafts.c
+3
-0
src/libgit2/remote.c
+5
-2
src/libgit2/repository.c
+2
-4
src/libgit2/transports/smart.c
+0
-6
src/libgit2/transports/smart.h
+0
-2
No files found.
src/libgit2/grafts.c
View file @
da04d3fc
...
...
@@ -43,6 +43,9 @@ int git_grafts_from_file(git_grafts **out, const char *path)
git_grafts
*
grafts
=
NULL
;
int
error
;
if
(
*
out
)
return
git_grafts_refresh
(
*
out
);
if
((
error
=
git_grafts_new
(
&
grafts
))
<
0
)
goto
error
;
...
...
src/libgit2/remote.c
View file @
da04d3fc
...
...
@@ -2150,6 +2150,11 @@ void git_remote_free(git_remote *remote)
remote
->
transport
=
NULL
;
}
if
(
remote
->
nego
.
shallow_roots
)
{
git_array_clear
(
remote
->
nego
.
shallow_roots
->
array
);
git__free
(
remote
->
nego
.
shallow_roots
);
}
git_vector_free
(
&
remote
->
refs
);
free_refspecs
(
&
remote
->
refspecs
);
...
...
@@ -2164,8 +2169,6 @@ void git_remote_free(git_remote *remote)
free_heads
(
&
remote
->
local_heads
);
git_vector_free
(
&
remote
->
local_heads
);
git_shallowarray_free
((
remote
->
nego
).
shallow_roots
);
git_push_free
(
remote
->
push
);
git__free
(
remote
->
url
);
git__free
(
remote
->
pushurl
);
...
...
src/libgit2/repository.c
View file @
da04d3fc
...
...
@@ -3346,13 +3346,11 @@ int git_repository__shallow_roots(git_array_oid_t *out, git_repository *repo) {
if
(
!
repo
->
shallow_grafts
&&
(
error
=
load_grafts
(
repo
))
<
0
)
return
error
;
if
((
error
=
git_grafts_refresh
(
repo
->
shallow_grafts
))
<
0
)
{
if
((
error
=
git_grafts_refresh
(
repo
->
shallow_grafts
))
<
0
)
return
error
;
}
if
((
error
=
git_grafts_get_oids
(
out
,
repo
->
shallow_grafts
))
<
0
)
{
if
((
error
=
git_grafts_get_oids
(
out
,
repo
->
shallow_grafts
))
<
0
)
return
error
;
}
return
0
;
}
...
...
src/libgit2/transports/smart.c
View file @
da04d3fc
...
...
@@ -510,9 +510,3 @@ int git_shallowarray_remove(git_shallowarray *array, git_oid *oid)
/* no git_array_remove… meh */
return
-
1
;
}
void
git_shallowarray_free
(
git_shallowarray
*
array
)
{
git_array_clear
(
array
->
array
);
git__free
(
array
);
}
src/libgit2/transports/smart.h
View file @
da04d3fc
...
...
@@ -203,6 +203,4 @@ struct git_shallowarray {
git_array_oid_t
array
;
};
void
git_shallowarray_free
(
git_shallowarray
*
array
);
#endif
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