Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: Fix DEFAULTs AST memory leak on alter
Date: Tue, 25 Dec 2018 15:37:26 +0300	[thread overview]
Message-ID: <3bbec3b9-c9e9-9d2e-7b29-e8ced2f51518@tarantool.org> (raw)
In-Reply-To: <a9dc4eeafac2a1e4fb2fa368a01ad668fc116e5d.1545739120.git.kshcherbatov@tarantool.org>

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)
  */

  reply	other threads:[~2018-12-25 12:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-25 12:00 [tarantool-patches] " Kirill Shcherbatov
2018-12-25 12:37 ` Kirill Shcherbatov [this message]
2018-12-25 12:38   ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-25 13:29 ` Kirill Yukhin

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=3bbec3b9-c9e9-9d2e-7b29-e8ced2f51518@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: Fix DEFAULTs AST memory leak on alter' \
    /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