Commit 81be2f46 by Carlos Martín Nieto

ssh: move NULL check to the free function

Let `ssh_stream_free()` take a NULL stream, as free functions should,
and remove the check from the connection setup.

The connection setup would not need the check anyhow, as we always have
a stream by the time we reach this code.
parent 2785544f
...@@ -177,11 +177,12 @@ static int ssh_stream_write( ...@@ -177,11 +177,12 @@ static int ssh_stream_write(
static void ssh_stream_free(git_smart_subtransport_stream *stream) static void ssh_stream_free(git_smart_subtransport_stream *stream)
{ {
ssh_stream *s = (ssh_stream *)stream; ssh_stream *s = (ssh_stream *)stream;
ssh_subtransport *t = OWNING_SUBTRANSPORT(s); ssh_subtransport *t;
int ret;
GIT_UNUSED(ret); if (!stream)
return;
t = OWNING_SUBTRANSPORT(s);
t->current_stream = NULL; t->current_stream = NULL;
if (s->channel) { if (s->channel) {
...@@ -621,7 +622,6 @@ static int _git_ssh_setup_conn( ...@@ -621,7 +622,6 @@ static int _git_ssh_setup_conn(
done: done:
if (error < 0) { if (error < 0) {
if (*stream)
ssh_stream_free(*stream); ssh_stream_free(*stream);
if (session) if (session)
......
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