From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A93F9469719 for ; Tue, 6 Oct 2020 16:33:22 +0300 (MSK) Date: Tue, 6 Oct 2020 13:33:21 +0000 From: Nikita Pettik Message-ID: <20201006133321.GD12999@tarantool.org> References: <2d28f4f21cc5bd3a5a7b03470bc1b257864fef67.1601910155.git.kyukhin@tarantool.org> <20201005213714.GA12999@tarantool.org> <20201006041356.auru6xvyfneveytl@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201006041356.auru6xvyfneveytl@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] vinyl: fix leak in vy_build_recover_stmt List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kirill Yukhin Cc: tarantool-patches@dev.tarantool.org On 06 Oct 07:13, Kirill Yukhin wrote: > Hello, > > On 05 окт 21:37, Nikita Pettik wrote: > > On 05 Oct 18:33, Kirill Yukhin wrote: > > > diff --git a/src/box/vinyl.c b/src/box/vinyl.c > > > index cee39c5..a7ab24d 100644 > > > --- a/src/box/vinyl.c > > > +++ b/src/box/vinyl.c > > > @@ -4026,19 +4026,21 @@ vy_build_recover_stmt(struct vy_lsm *lsm, struct vy_lsm *pk, > > > insert = vy_stmt_new_insert(lsm->mem_format, > > > data, data + data_len); > > > if (insert == NULL) > > > - return -1; > > > + goto err; > > > } else if (type == IPROTO_UPSERT) { > > > struct tuple *new_tuple = vy_apply_upsert(mem_stmt, old_tuple, > > > pk->cmp_def, true); > > > if (new_tuple == NULL) > > > - return -1; > > > + goto err; > > > uint32_t data_len; > > > const char *data = tuple_data_range(new_tuple, &data_len); > > > insert = vy_stmt_new_insert(lsm->mem_format, > > > data, data + data_len); > > > tuple_unref(new_tuple); > > > - if (insert == NULL) > > > - return -1; > > > + if (insert == NULL) { > > > + tuple_unref(new_tuple); > > > > new_tuple is unrefed one line above unconditionally. > > Thanks, removed. Iterative patch in the bottom. > Branch force-pushed. Pushed to master, 2.5, 2.4 and 1.10. Branch is dropped. > -- > Regards, Kirill Yukhin > > diff --git a/src/box/vinyl.c b/src/box/vinyl.c > index a7ab24d..7e56299 100644 > --- a/src/box/vinyl.c > +++ b/src/box/vinyl.c > @@ -4037,10 +4037,8 @@ vy_build_recover_stmt(struct vy_lsm *lsm, struct vy_lsm *pk, > insert = vy_stmt_new_insert(lsm->mem_format, > data, data + data_len); > tuple_unref(new_tuple); > - if (insert == NULL) { > - tuple_unref(new_tuple); > + if (insert == NULL) > goto err; > - } > } > > /* Insert DELETE + INSERT into the LSM tree. */