Commit 470a05d0 by Sven Strickroth

Do not return free'd git_repository object on error

Regression introduced in commit dde6d9c7.

This issue causes lots of crashes in TortoiseGit.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent dea5ce3d
......@@ -865,8 +865,7 @@ cleanup:
if (error < 0)
git_repository_free(repo);
if (repo_ptr)
else if (repo_ptr)
*repo_ptr = repo;
return error;
......
......@@ -277,7 +277,9 @@ void test_repo_open__bad_gitlinks(void)
for (scan = bad_links; *scan != NULL; scan++) {
make_gitlink_dir("alternate", *scan);
repo = NULL;
cl_git_fail(git_repository_open_ext(&repo, "alternate", 0, NULL));
cl_assert(repo == NULL);
}
git_futils_rmdir_r("invalid", NULL, GIT_RMDIR_REMOVE_FILES);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment