From 0c89a974259852fb68656918fa5d66bf4cae2c92 Mon Sep 17 00:00:00 2001 From: Alexandr Lyapunov <a.lyapunov@corp.mail.ru> Date: Mon, 15 Jun 2015 12:11:36 +0300 Subject: [PATCH] *) merge with 1.5 - possibe fix of OPENTAR-97 *) fixed potentionally unsafe code: on memory fail there could be port->found > 0 and uninitialized port->svp --- src/box/iproto_port.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/box/iproto_port.cc b/src/box/iproto_port.cc index 0624adce98..06110d6b8b 100644 --- a/src/box/iproto_port.cc +++ b/src/box/iproto_port.cc @@ -148,10 +148,11 @@ static inline void iproto_port_add_tuple(struct port *ptr, struct tuple *tuple) { struct iproto_port *port = iproto_port(ptr); - if (++port->found == 1) { + if (port->found == 0) { /* Found the first tuple, add header. */ port->svp = iproto_prepare_select(port->buf); } + port->found++; tuple_to_obuf(tuple, port->buf); } -- GitLab