Commit Diff


commit - 378238485424df9326c721ce1613ea1f49ef5a72
commit + f2db9c479fbdf8dfb2f58619e6e62781117a14b8
blob - f7044b4650178445f7122537b90eeb272ddafe4b
blob + 597eaa8460d3d4d0ff76a611f1aa43c353e86b5f
--- lib/repository.c
+++ lib/repository.c
@@ -397,13 +397,15 @@ got_repo_open(struct got_repository **repop, const cha
 		if (path[0] == '/' && path[1] == '\0') {
 			if (tried_root) {
 				err = got_error(GOT_ERR_NOT_GIT_REPO);
-				break;
+				goto done;
 			}
 			tried_root = 1;
 		}
 		path = dirname(path);
-		if (path == NULL)
+		if (path == NULL) {
 			err = got_error_from_errno2("dirname", path);
+			goto done;
+		}
 	} while (path);
 
 	err = get_path_gitconfig(&gitconfig_path, repo);