From: Timo Sirainen Date: Wed, 8 Nov 2017 12:35:31 +0000 (+0200) Subject: doveadm: client - Cleanup: Handle input NULL first X-Git-Tag: 2.3.0.rc1~452 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9f869f9ab6552b75f18f576eb45229e2c698eb59;p=thirdparty%2Fdovecot%2Fcore.git doveadm: client - Cleanup: Handle input NULL first --- diff --git a/src/doveadm/server-connection.c b/src/doveadm/server-connection.c index fdef25d731..7cc62b5718 100644 --- a/src/doveadm/server-connection.c +++ b/src/doveadm/server-connection.c @@ -354,7 +354,13 @@ static void server_connection_input(struct server_connection *conn) } while (!conn->authenticated) { - if ((line = i_stream_next_line(conn->input)) != NULL) { + if ((line = i_stream_next_line(conn->input)) == NULL) { + if (conn->input->eof || conn->input->stream_errno != 0) { + server_log_disconnect_error(conn); + server_connection_destroy(&conn); + } + return; + } else { /* Allow VERSION before or after the "+" or "-" line, because v2.2.33 sent the version after and newer versions send before. */ @@ -393,12 +399,6 @@ static void server_connection_input(struct server_connection *conn) server_connection_destroy(&conn); return; } - } else { - if (conn->input->eof || conn->input->stream_errno != 0) { - server_log_disconnect_error(conn); - server_connection_destroy(&conn); - } - return; } }