From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 26 Oct 2018 11:06:19 +0300 From: Vladimir Davydov Subject: Re: [PATCH] vinyl: fix memory leak in slice stream Message-ID: <20181026080619.jgmveaqnxv3d4kk7@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: Pushed to 1.10 as trivial On Thu, Oct 25, 2018 at 08:37:23PM +0300, Vladimir Davydov wrote: > If a tuple read from a run by a slice stream happens to be out of the > slice bounds, it will never be freed. Fix it. > > The leak was introduced by commit c174c985485c ("vinyl: implement new > simple write iterator"). > --- > https://github.com/tarantool/tarantool/commits/dv/vy-fix-memleak-in-slice-stream > > src/box/vy_run.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/box/vy_run.c b/src/box/vy_run.c > index bb5baf2c..454833e7 100644 > --- a/src/box/vy_run.c > +++ b/src/box/vy_run.c > @@ -2567,8 +2567,10 @@ vy_slice_stream_next(struct vy_stmt_stream *virt_stream, struct tuple **ret) > if (stream->slice->end != NULL && > stream->page_no >= stream->slice->last_page_no && > vy_tuple_compare_with_key(tuple, stream->slice->end, > - stream->cmp_def) >= 0) > + stream->cmp_def) >= 0) { > + tuple_unref(tuple); > return 0; > + } > > /* We definitely has the next non-null tuple. Save it in stream */ > if (stream->tuple != NULL)