From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (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 178D3469711 for ; Fri, 22 May 2020 20:45:38 +0300 (MSK) Date: Fri, 22 May 2020 17:45:37 +0000 From: Nikita Pettik Message-ID: <20200522174537.GA27746@tarantool.org> References: <43fb37622b80a324dd88e716e3c21d4672a200eb.1590090084.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <43fb37622b80a324dd88e716e3c21d4672a200eb.1590090084.git.v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 1/1] vinyl: add missing diag_set in space creation List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org On 21 May 21:41, Vladislav Shpilevoy wrote: > vinyl_engine_create_space() didn't set an error in the > diagnostics area when region_alloc() failed. This > could lead to a crash, although was almost impossible > to happen. LGTM. > --- > Branch: http://github.com/tarantool/tarantool/tree/gerold103/vinyl-add-missing-diag > > src/box/vinyl.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/box/vinyl.c b/src/box/vinyl.c > index ea4839dea..950a5508c 100644 > --- a/src/box/vinyl.c > +++ b/src/box/vinyl.c > @@ -602,9 +602,11 @@ vinyl_engine_create_space(struct engine *engine, struct space_def *def, > struct index_def *index_def; > rlist_foreach_entry(index_def, key_list, link) > key_count++; > - struct key_def **keys = region_alloc(&fiber()->gc, > - sizeof(*keys) * key_count); > + struct key_def **keys; > + size_t size = sizeof(*keys) * key_count; > + keys = region_alloc(&fiber()->gc, size); > if (keys == NULL) { > + diag_set(OutOfMemory, size, "region_alloc", "keys"); > free(space); > return NULL; > } > -- > 2.21.1 (Apple Git-122.3) >