[patches] [PATCH 2/4] Fix a pair of memory leaks
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Mon Mar 12 00:53:34 MSK 2018
Signed-off-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
---
src/box/alter.cc | 2 +-
src/box/vy_index.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/box/alter.cc b/src/box/alter.cc
index 8a62d8ed8..7eec4786b 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -326,7 +326,7 @@ index_def_new_from_tuple(struct tuple *tuple, struct space *space)
tnt_raise(OutOfMemory, sizeof(*part_def) * part_count,
"malloc", "key_part_def");
}
- auto key_def_guard = make_scoped_guard([=] {
+ auto key_def_guard = make_scoped_guard([&] {
free(part_def);
free(key_def);
});
diff --git a/src/box/vy_index.c b/src/box/vy_index.c
index 5809204dc..68fccab52 100644
--- a/src/box/vy_index.c
+++ b/src/box/vy_index.c
@@ -308,8 +308,7 @@ vy_index_delete(struct vy_index *index)
tuple_format_unref(index->disk_format);
tuple_format_unref(index->mem_format_with_colmask);
tuple_format_unref(index->upsert_format);
- if (index->id > 0)
- free(index->cmp_def);
+ free(index->cmp_def);
free(index->key_def);
histogram_delete(index->run_hist);
vy_index_stat_destroy(&index->stat);
--
2.14.3 (Apple Git-98)
More information about the Tarantool-patches
mailing list