Unverified Commit 1908884d by Patrick Steinhardt Committed by GitHub

Merge pull request #5361 from csware/no-return-freed_object

Do not return free'd git_repository object on error
parents 47ac1187 470a05d0
......@@ -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