[Tarantool-patches] [PATCH 1/1] fk: fix wrong sizeof() in fk_constraint_def_sizeof()
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Thu May 28 02:25:41 MSK 2020
The function returns a number of bytes needed to store
an fk_constraint_def object with its name and links.
However it used sizeof(struct fk_constraint) instead
of sizeof(struct fk_constraint_def) to calculate
base object size. This worked only because
fk_constraint is bigger than fk_constraint_def.
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/fk_constraint_sizeof
src/box/fk_constraint.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/box/fk_constraint.h b/src/box/fk_constraint.h
index fee82afb0..b1e0cfb84 100644
--- a/src/box/fk_constraint.h
+++ b/src/box/fk_constraint.h
@@ -131,7 +131,7 @@ struct fk_constraint {
static inline size_t
fk_constraint_def_sizeof(uint32_t link_count, uint32_t name_len)
{
- return sizeof(struct fk_constraint) +
+ return sizeof(struct fk_constraint_def) +
link_count * sizeof(struct field_link) +
name_len + 1;
}
--
2.21.1 (Apple Git-122.3)
More information about the Tarantool-patches
mailing list