summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-02-22 16:01:03 +0100
committerPatrick Steinhardt <ps@pks.im>2016-02-23 12:07:36 +0100
commitd0cb11e794de0dbf3998ad88357c17f5d8bf843c (patch)
tree413c2aa96b407268e786e34ec0ff18925f93f6af
parent0f1e2d2066115e62fd7396e0f436b4a5dd8384cd (diff)
downloadlibgit2-d0cb11e794de0dbf3998ad88357c17f5d8bf843c.tar.gz
remote: set error code in `create_internal`
Set the error code when an error occurs in any of the called functions. This ensures we pass the error up to callers and actually free the remote when an error occurs.
-rw-r--r--src/remote.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/remote.c b/src/remote.c
index 2f8ffcb37..8b7203ee2 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -208,8 +208,8 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
remote->repo = repo;
- if (git_vector_init(&remote->refs, 32, NULL) < 0 ||
- canonicalize_url(&canonical_url, url) < 0)
+ if ((error = git_vector_init(&remote->refs, 32, NULL)) < 0 ||
+ (error = canonicalize_url(&canonical_url, url)) < 0)
goto on_error;
remote->url = apply_insteadof(repo->_config, canonical_url.ptr, GIT_DIRECTION_FETCH);