]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: client - Cleanup: Handle input NULL first
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 8 Nov 2017 12:35:31 +0000 (14:35 +0200)
committerTimo Sirainen <tss@dovecot.fi>
Wed, 15 Nov 2017 20:24:08 +0000 (22:24 +0200)
src/doveadm/server-connection.c

index fdef25d731450242637f61723b30c15a6c432d79..7cc62b57182d28d4cd7e0ca380fd11acc154b6d0 100644 (file)
@@ -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;
                }
        }