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
b545be3d
Commit
b545be3d
authored
Sep 10, 2019
by
Laurence McGlashan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open:fix memory leak when passing NULL to git_repository_open_ext
parent
c3a7892f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
src/repository.c
+6
-1
tests/repo/open.c
+11
-0
No files found.
src/repository.c
View file @
b545be3d
...
...
@@ -812,8 +812,13 @@ int git_repository_open_ext(
error
=
find_repo
(
&
gitdir
,
&
workdir
,
&
gitlink
,
&
commondir
,
start_path
,
flags
,
ceiling_dirs
);
if
(
error
<
0
||
!
repo_ptr
)
if
(
error
<
0
||
!
repo_ptr
)
{
git_buf_dispose
(
&
gitdir
);
git_buf_dispose
(
&
workdir
);
git_buf_dispose
(
&
gitlink
);
git_buf_dispose
(
&
commondir
);
return
error
;
}
repo
=
repository_alloc
();
GIT_ERROR_CHECK_ALLOC
(
repo
);
...
...
tests/repo/open.c
View file @
b545be3d
...
...
@@ -88,6 +88,17 @@ void test_repo_open__open_with_discover(void)
cl_fixture_cleanup
(
"attr"
);
}
void
test_repo_open__check_if_repository
(
void
)
{
cl_git_sandbox_init
(
"empty_standard_repo"
);
/* Pass NULL for the output parameter to check for but not open the repo */
cl_git_pass
(
git_repository_open_ext
(
NULL
,
"empty_standard_repo"
,
0
,
NULL
));
cl_git_fail
(
git_repository_open_ext
(
NULL
,
"repo_does_not_exist"
,
0
,
NULL
));
cl_fixture_cleanup
(
"empty_standard_repo"
);
}
static
void
make_gitlink_dir
(
const
char
*
dir
,
const
char
*
linktext
)
{
git_buf
path
=
GIT_BUF_INIT
;
...
...
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