summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2018-08-21 01:55:56 +0200
committerPatrick Steinhardt <ps@pks.im>2018-10-26 14:58:51 +0200
commit01b8bbf4431f367c04bd7afad632c08f6881f7cf (patch)
treedb13ce32c31620d1aabd7e410850ae7577a908f1
parentc0e038a29b28b43e5bf5e4c246a8fa5fa2bb2cd9 (diff)
downloadlibgit2-01b8bbf4431f367c04bd7afad632c08f6881f7cf.tar.gz
remote: set the error before cleanup
Otherwise we'll return stack data to the caller. (cherry picked from commit 22d013b657c5957fde31641351cb72d08cc192ae)
-rw-r--r--src/remote.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/remote.c b/src/remote.c
index d8a6b991d..b3252b653 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -428,7 +428,7 @@ static int get_optional_config(
int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
{
- git_remote *remote;
+ git_remote *remote = NULL;
git_buf buf = GIT_BUF_INIT;
const char *val;
int error = 0;
@@ -510,7 +510,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
if ((error = get_optional_config(NULL, config, &buf, refspec_cb, &data)) < 0)
goto cleanup;
- if (download_tags_value(remote, config) < 0)
+ if ((error = download_tags_value(remote, config)) < 0)
goto cleanup;
if ((error = lookup_remote_prune_config(remote, config, name)) < 0)