From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 9E3AE2179F for ; Tue, 25 Dec 2018 07:38:41 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k7kYqY105_g3 for ; Tue, 25 Dec 2018 07:38:41 -0500 (EST) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 59D9121799 for ; Tue, 25 Dec 2018 07:38:41 -0500 (EST) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: Fix DEFAULTs AST memory leak on alter References: <3bbec3b9-c9e9-9d2e-7b29-e8ced2f51518@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Tue, 25 Dec 2018 15:38:39 +0300 MIME-Version: 1.0 In-Reply-To: <3bbec3b9-c9e9-9d2e-7b29-e8ced2f51518@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Kirill Shcherbatov , tarantool-patches@freelists.org, Kirill Yukhin LGTM. On 25/12/2018 15:37, Kirill Shcherbatov wrote: > Extras: catch another one memleak, better comment > > diff --git b/src/box/alter.cc a/src/box/alter.cc > index 5ec57590e..27b06c083 100644 > --- b/src/box/alter.cc > +++ a/src/box/alter.cc > @@ -540,6 +540,7 @@ space_def_new_from_tuple(struct tuple *tuple, uint32_t errcode, > space_def_new_xc(id, uid, exact_field_count, name, name_len, > engine_name, engine_name_len, &opts, fields, > field_count); > + auto def_guard = make_scoped_guard([=] { space_def_delete(def); }); > if (def->opts.checks != NULL && > sql_checks_resolve_space_def_reference(def->opts.checks, > def) != 0) { > @@ -551,7 +552,6 @@ space_def_new_from_tuple(struct tuple *tuple, uint32_t errcode, > diag_raise(); > } > } > - auto def_guard = make_scoped_guard([=] { space_def_delete(def); }); > struct engine *engine = engine_find_xc(def->engine_name); > engine_check_space_def_xc(engine, def); > def_guard.is_active = false; > diff --git b/src/box/space_def.h a/src/box/space_def.h > index e99581dab..8044f88fd 100644 > --- b/src/box/space_def.h > +++ a/src/box/space_def.h > @@ -123,6 +123,9 @@ struct space_def { > * @param fields Fields array to destroy. > * @param field_count Length of @a fields. > * @param extern_alloc Fields expression AST allocated externally. > + * (specify false when sql_expr_delete should > + * release default_value_expr memory, > + * true - when shouldn't) > */ >