diff options
author | Laurence McGlashan <Laurence.McGlashan@mathworks.co.uk> | 2019-09-10 11:14:36 +0100 |
---|---|---|
committer | Laurence McGlashan <Laurence.McGlashan@mathworks.co.uk> | 2019-09-10 11:15:54 +0100 |
commit | b545be3dbf3ff2d2aceff955641efae828ed9853 (patch) | |
tree | 37e8a4980257bb42a4703fc57044e94755c384ad /src/repository.c | |
parent | c3a7892f30fea72692fafae0e6ff567e5cb8726c (diff) | |
download | libgit2-b545be3dbf3ff2d2aceff955641efae828ed9853.tar.gz |
open:fix memory leak when passing NULL to git_repository_open_ext
Diffstat (limited to 'src/repository.c')
-rw-r--r-- | src/repository.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/repository.c b/src/repository.c index f9c4ef42a..e1e3ef0af 100644 --- a/src/repository.c +++ b/src/repository.c @@ -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); |