Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] Fix tuple leak in vy_build_recover_stmt
Date: Thu, 12 Nov 2020 13:21:34 +0300	[thread overview]
Message-ID: <20201112102134.GA156808@hpalx> (raw)
In-Reply-To: <4e5bec04c11d294335c6725a8def2034c8bf3385.1605087058.git.kyukhin@tarantool.org>

Hi Kirill, I've checked all results in gitlab-ci, and no new degradations
found [1], patch LGTM.

[1] - https://gitlab.com/tarantool/tarantool/-/pipelines/215136994

On Wed, Nov 11, 2020 at 12:38:10PM +0300, Kirill Yukhin wrote:
> Variable `old` which contains tuple reference wasn't
> unrefed at all. Fix this.
> ---
> 
> Branch: https://github.com/tarantool/tarantool/tree/kyukhin/fix-vy-build-recover-leak
> Issue: N/A
> CI: https://gitlab.com/tarantool/tarantool/-/pipelines/212266538
> 
>  src/box/vinyl.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/box/vinyl.c b/src/box/vinyl.c
> index 57e2839..0ff1262 100644
> --- a/src/box/vinyl.c
> +++ b/src/box/vinyl.c
> @@ -4020,8 +4020,10 @@ vy_build_recover_stmt(struct vy_lsm *lsm, struct vy_lsm *pk,
>  	if (old_tuple != NULL) {
>  		delete = vy_stmt_new_surrogate_delete(lsm->mem_format,
>  						      old_tuple);
> -		if (delete == NULL)
> +		if (delete == NULL) {
> +			tuple_unref(old_tuple);
>  			return -1;
> +		}
>  	}
>  	enum iproto_type type = vy_stmt_type(mem_stmt);
>  	if (type == IPROTO_REPLACE || type == IPROTO_INSERT) {
> @@ -4045,6 +4047,9 @@ vy_build_recover_stmt(struct vy_lsm *lsm, struct vy_lsm *pk,
>  			goto err;
>  	}
>  
> +	if (old_tuple != NULL)
> +		tuple_unref(old_tuple);
> +
>  	/* Insert DELETE + INSERT into the LSM tree. */
>  	if (delete != NULL) {
>  		int rc = vy_build_insert_stmt(lsm, lsm->mem, delete, lsn);
> @@ -4061,6 +4066,8 @@ vy_build_recover_stmt(struct vy_lsm *lsm, struct vy_lsm *pk,
>  	return 0;
>  
>  err:
> +	if (old_tuple != NULL)
> +		tuple_unref(old_tuple);
>  	if (delete != NULL)
>  		tuple_unref(delete);
>  	return -1;
> -- 
> 2.11.0
> 

  parent reply	other threads:[~2020-11-12 10:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  9:38 Kirill Yukhin
2020-11-11 17:24 ` Nikita Pettik
2020-11-12 10:21 ` Alexander V. Tikhonov [this message]
2020-11-12 10:25 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112102134.GA156808@hpalx \
    --to=avtikhon@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] Fix tuple leak in vy_build_recover_stmt' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox