commit c153a9fd3d495d2d297c1d38ef706880800a15a9
parent 2ba86d0368f31564614552c88ae03d451b535e4a
Author: Eyal Sawady <ecs@d2evs.net>
Date: Thu, 25 Feb 2021 06:45:49 -0500
tagged_init: memove the correct number of bytes
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/type_store.c b/src/type_store.c
@@ -307,7 +307,8 @@ tagged_init(struct type *type, struct type_tagged_union **tu, size_t nmemb)
for (size_t i = 1; i < nmemb; ++i)
for (size_t j = 0; j < i; ++j) {
if (tu[j]->type->id == tu[i]->type->id) {
- memmove(&tu[i], &tu[i + 1], nmemb - i - 1);
+ memmove(&tu[i], &tu[i + 1], (nmemb - i - 1)
+ * sizeof(struct type_tagged_union *));
--nmemb;
break;
}