]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth: Crashfix.
authorTimo Sirainen <tss@iki.fi>
Tue, 20 Oct 2009 23:40:52 +0000 (19:40 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 20 Oct 2009 23:40:52 +0000 (19:40 -0400)
--HG--
branch : HEAD

src/lib-auth/auth-server-connection.c

index 2e3c3653e6012ea3785ee9d75340159910acf676..3cc89d8908d3f50870abc432e1bc5e728163121c 100644 (file)
@@ -317,12 +317,14 @@ static void auth_server_connection_close(struct auth_server_connection *conn)
                timeout_remove(&conn->to);
        if (conn->io != NULL)
                io_remove(&conn->io);
-       i_stream_destroy(&conn->input);
-       o_stream_destroy(&conn->output);
+       if (conn->fd != -1) {
+               i_stream_destroy(&conn->input);
+               o_stream_destroy(&conn->output);
 
-       if (close(conn->fd) < 0)
-               i_error("close(auth server connection) failed: %m");
-       conn->fd = -1;
+               if (close(conn->fd) < 0)
+                       i_error("close(auth server connection) failed: %m");
+               conn->fd = -1;
+       }
 
        auth_server_connection_remove_requests(conn);