From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v4 2/2] box: introduce _vsession_settings sysview
Date: Sun, 24 Nov 2019 16:27:58 +0100 [thread overview]
Message-ID: <3deea5d5-cc8e-0943-1ad3-07ecc0263088@tarantool.org> (raw)
In-Reply-To: <84ae817b52e0d9415a0b89c730792b1e0221ff24.1574510839.git.imeevma@gmail.com>
Hi! Thanks for the patch!
> diff --git a/src/box/session.cc b/src/box/session.cc
> index 461d1cf..93d8b42 100644
> --- a/src/box/session.cc
> +++ b/src/box/session.cc
> @@ -338,3 +341,131 @@ generic_session_sync(struct session *session)
> +
> +struct iterator *
> +session_options_create_iterator(struct index *index, enum iterator_type type,
> + const char *key, uint32_t part_count)
> +{
> + char *decoded_key = NULL;
> + if (part_count > 0) {
> + assert(part_count == 1);
> + assert(mp_typeof(*key) == MP_STR);
> + uint32_t len;
> + const char *name = mp_decode_str(&key, &len);
> + decoded_key = (char *)malloc(len + 1);
> + if (decoded_key == NULL) {
> + diag_set(OutOfMemory, len + 1, "malloc", "decoded_key");
> + return NULL;
> + }
> + memcpy(decoded_key, name, len);
> + decoded_key[len] = '\0';
> + }
> + struct space *space = space_cache_find(index->def->space_id);
> + struct session_options_iterator *it =
> + (session_options_iterator *)malloc(sizeof(*it));
> + if (it == NULL) {
decoded_key leaks here. But heap OOM is such an unlikely event,
and is forgotten for be checked so often, that perhaps we should
reconsider moving this https://github.com/tarantool/tarantool/issues/3534
out of wish list and start using panic in new places. Probably
wrapped into a 'heap_alloc()' function (name is discussable).
I think, Kirill won't be against this.
next prev parent reply other threads:[~2019-11-24 15:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 12:11 [Tarantool-patches] [PATCH v4 0/2] " imeevma
2019-11-23 12:11 ` [Tarantool-patches] [PATCH v4 1/2] sysview: make get() and create_iterator() methods virtual imeevma
2019-11-23 12:12 ` [Tarantool-patches] [PATCH v4 2/2] box: introduce _vsession_settings sysview imeevma
2019-11-24 15:27 ` Vladislav Shpilevoy [this message]
2019-11-27 9:53 ` Mergen Imeev
2019-11-27 23:14 ` Vladislav Shpilevoy
2019-11-26 21:12 ` Konstantin Osipov
2019-11-27 5:15 ` Kirill Yukhin
2019-11-27 10:34 ` Konstantin Osipov
2019-11-27 10:52 ` Mergen Imeev
2019-11-27 11:05 ` Konstantin Osipov
2019-11-27 11:18 ` Mergen Imeev
2019-11-27 11:37 ` Konstantin Osipov
2019-11-27 12:12 ` Mergen Imeev
2019-11-28 8:46 [Tarantool-patches] [PATCH v4 0/2] Introduce " imeevma
2019-11-28 8:46 ` [Tarantool-patches] [PATCH v4 2/2] box: introduce " imeevma
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=3deea5d5-cc8e-0943-1ad3-07ecc0263088@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=imeevma@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v4 2/2] box: introduce _vsession_settings sysview' \
/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