Commit Diff


commit - cc483380c54d31f8ddf61787337cefe1ccf3581b
commit + 6b68ccd6c881df83e78cf8b525ccfa3c0c3c21d0
blob - 597eaa8460d3d4d0ff76a611f1aa43c353e86b5f
blob + dbee69ba57b1497c455672f6741600c07c1f5af1
--- lib/repository.c
+++ lib/repository.c
@@ -312,6 +312,7 @@ open_repo(struct got_repository *repo, const char *pat
 
 	/* git repository with working tree? */
 	free(repo->path_git_dir);
+	repo->path_git_dir = NULL;
 	if (asprintf(&repo->path_git_dir, "%s/%s", path, GOT_GIT_DIR) == -1) {
 		err = got_error_from_errno("asprintf");
 		goto done;