Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: tml <tarantool-patches@dev.tarantool.org>
Subject: [Tarantool-patches] [PATCH] box/request: add missing diag_set on tuple alloc failure
Date: Fri, 17 Jan 2020 15:29:03 +0300	[thread overview]
Message-ID: <20200117122903.29400-1-gorcunov@gmail.com> (raw)

In case if region_alloc failed we should setup diag
error so the caller would be notified.

Otherwise the caller may do diag_raise and get
nil dereference.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
The patch is on top of commit b89c62bd78bef94e199fddb9920a771e7b8dc325 (origin/2.2)
Might be related to https://github.com/tarantool/tarantool/issues/4730

 src/box/request.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/box/request.c b/src/box/request.c
index 82232a155..a460392c9 100644
--- a/src/box/request.c
+++ b/src/box/request.c
@@ -199,8 +199,10 @@ request_handle_sequence(struct request *request, struct space *space)
 		size_t buf_size = (request->tuple_end - request->tuple) +
 						mp_sizeof_uint(UINT64_MAX);
 		char *tuple = region_alloc(&fiber()->gc, buf_size);
-		if (tuple == NULL)
+		if (tuple == NULL) {
+			diag_set(OutOfMemory, buf_size, "region_alloc", "tuple");
 			return -1;
+		}
 		char *tuple_end = mp_encode_array(tuple, len);
 
 		if (unlikely(key != data)) {
-- 
2.20.1

             reply	other threads:[~2020-01-17 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 12:29 Cyrill Gorcunov [this message]
2020-01-17 13:29 ` Cyrill Gorcunov

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=20200117122903.29400-1-gorcunov@gmail.com \
    --to=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] box/request: add missing diag_set on tuple alloc failure' \
    /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