iproto: log error before iproto_write_error
iproto_write_error() may reset diag (for example, if the client closes the socket), thus invalidating the error we are going to log and leading to a use after free bug. We must log the error before trying to send it to the client. The bug was introduced by commit 9b4ab9fe ("iproto: use iostream abstraction"), which switched iproto_write_error() from plain write() to the iostream_write(), which may set diag. Closes #6890 NO_DOC=bug fix NO_CHANGELOG=unreleased
Loading