From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (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 EBFDF440F3C for ; Wed, 13 Nov 2019 01:30:18 +0300 (MSK) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3594.4.19\)) From: Roman Khabibov In-Reply-To: <20191112141725.GC5130@uranus> Date: Wed, 13 Nov 2019 01:30:17 +0300 Content-Transfer-Encoding: 7bit Message-Id: <8A723C04-5B21-4EB2-859E-89088EBF38B3@tarantool.org> References: <49805fa2211dfa3e5d92a34a740a3f9cf488c327.1573566885.git.roman.habibov@tarantool.org> <20191112141725.GC5130@uranus> Subject: Re: [Tarantool-patches] [PATCH 1/2] box: introduce constraint names hash table List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org Forgot to check for NULL. I will add. > On Nov 12, 2019, at 17:17, Cyrill Gorcunov wrote: > > On Tue, Nov 12, 2019 at 05:02:58PM +0300, Roman Khabibov wrote: >> + >> +int >> +space_put_constraint_name(struct space *space, const char *name) >> +{ >> + uint32_t len = strlen(name); >> + uint32_t hash = mh_strn_hash(name, len); >> + char *name_copy = malloc(len); >> + memcpy(name_copy, name, len); > > What if malloc failed here?