[Tarantool-patches] [PATCH v4 22/53] sql: Initialize MEM in sqlVdbeAllocUnpackedRecord()
imeevma at tarantool.org
imeevma at tarantool.org
Tue Mar 23 12:35:44 MSK 2021
This patch adds initialization for newly created MEM objects in
sqlVdbeAllocUnpackedRecord(). Changing a MEM without being
initialized may give us unexpected result.
Part of #5818
---
src/box/sql/vdbeaux.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index e58526401..9d07358e6 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -2240,6 +2240,8 @@ sqlVdbeAllocUnpackedRecord(struct sql *db, struct key_def *key_def)
if (!p)
return 0;
p->aMem = (Mem *) & ((char *)p)[ROUND8(sizeof(UnpackedRecord))];
+ for (uint32_t i = 0; i < key_def->part_count + 1; ++i)
+ mem_create(&p->aMem[i]);
p->key_def = key_def;
p->nField = key_def->part_count + 1;
return p;
--
2.25.1
More information about the Tarantool-patches
mailing list