[tarantool-patches] Re: [PATCH v1 1/1] sql: Fix DEFAULTs AST memory leak on alter
Kirill Shcherbatov
kshcherbatov at tarantool.org
Tue Dec 25 15:37:26 MSK 2018
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)
*/
More information about the Tarantool-patches
mailing list