From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6B8B746970E for ; Fri, 17 Jan 2020 15:29:08 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id o13so26271230ljg.4 for ; Fri, 17 Jan 2020 04:29:08 -0800 (PST) From: Cyrill Gorcunov Date: Fri, 17 Jan 2020 15:29:03 +0300 Message-Id: <20200117122903.29400-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH] box/request: add missing diag_set on tuple alloc failure List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml 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 --- 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