summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurence McGlashan <mail@laurencemcglashan.com>2021-09-18 21:00:48 +0100
committerGitHub <noreply@github.com>2021-09-18 21:00:48 +0100
commitc8823fb05097cf38fa7f5cce0929e63c186f7a21 (patch)
tree161eb98e210efa87413f059eeee0704aa600a62b
parente994299f8b109c1ba336f0734871ceef944ac09d (diff)
downloadlibgit2-c8823fb05097cf38fa7f5cce0929e63c186f7a21.tar.gz
Apply suggestions from code review
Co-authored-by: Edward Thomson <ethomson@github.com>
-rw-r--r--src/remote.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/remote.c b/src/remote.c
index 9f604c3be..2ff1f7d13 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -888,19 +888,16 @@ static int http_proxy_config(char **out, git_remote *remote, git_net_url *url)
git_buf buf = GIT_BUF_INIT;
git_net_url lookup_url = GIT_NET_URL_INIT;
int error;
- int cleanup_config = 0;
if ((error = git_net_url_dup(&lookup_url, url)) < 0)
goto done;
if (remote->repo) {
- if ((error = git_repository_config__weakptr(&cfg, remote->repo)) < 0)
+ if ((error = git_repository_config(&cfg, remote->repo)) < 0)
goto done;
} else {
if ((error = git_config_open_default(&cfg)) < 0)
goto done;
-
- cleanup_config = 1;
}
/* remote.<name>.proxy config setting */
@@ -932,9 +929,7 @@ static int http_proxy_config(char **out, git_remote *remote, git_net_url *url)
error = lookup_config(out, cfg, "http.proxy");
done:
- if (cleanup_config)
- git_config_free(cfg);
-
+ git_config_free(cfg);
git_buf_dispose(&buf);
git_net_url_dispose(&lookup_url);
return error;