From b9faf0597bc826a250a7d07788b79afd32743a39 Mon Sep 17 00:00:00 2001 From: Alexandr Lyapunov <a.lyapunov@corp.mail.ru> Date: Mon, 15 Jun 2015 11:59:21 +0300 Subject: [PATCH] *) fixed exception-unsafe code: on memory fail there could be port->reply.found > 0 and uninitialized port->svp, that could lead to random error after svp restoration. *) possibly fixed OPENTAR-97 --- src/iproto_port.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iproto_port.cc b/src/iproto_port.cc index b6501ce08f..40d7df3bca 100644 --- a/src/iproto_port.cc +++ b/src/iproto_port.cc @@ -55,10 +55,11 @@ static inline void iproto_port_add_tuple(struct port *ptr, struct tuple *tuple, uint32_t flags) { struct iproto_port *port = iproto_port(ptr); - if (++port->reply.found == 1) { + if (port->reply.found == 0) { /* Found the first tuple, add header. */ port->svp = obuf_book(port->buf, sizeof(port->reply)); } + port->reply.found++; if (flags & BOX_RETURN_TUPLE) tuple_to_obuf(tuple, port->buf); } -- GitLab