Commit 68c7480a by Etienne Samson

smart: clarify error handling in git_smart__connect

parent 36a5b557
...@@ -279,9 +279,8 @@ static int git_smart__connect( ...@@ -279,9 +279,8 @@ static int git_smart__connect(
return error; return error;
/* Detect capabilities */ /* Detect capabilities */
if (git_smart__detect_caps(first, &t->caps, &symrefs) < 0) { if ((error = git_smart__detect_caps(first, &t->caps, &symrefs)) == 0) {
free_symrefs(&symrefs); goto cleanup;
return -1;
} }
/* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */ /* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
...@@ -294,15 +293,17 @@ static int git_smart__connect( ...@@ -294,15 +293,17 @@ static int git_smart__connect(
/* Keep a list of heads for _ls */ /* Keep a list of heads for _ls */
git_smart__update_heads(t, &symrefs); git_smart__update_heads(t, &symrefs);
free_symrefs(&symrefs);
if (t->rpc && git_smart__reset_stream(t, false) < 0) if (t->rpc && (error = git_smart__reset_stream(t, false)) < 0)
return -1; goto cleanup;
/* We're now logically connected. */ /* We're now logically connected. */
t->connected = 1; t->connected = 1;
return 0; cleanup:
free_symrefs(&symrefs);
return error;
} }
static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transport *transport) static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transport *transport)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment