Don't use allocsize uninitialized in Array(Array&&)

This fixes an integer overflow error that clang++ -fsanitize caught for
me, and might fix allocation failures for users with mem tracing
enabled.

Refs issue #188
This commit is contained in:
Roy Stogner 2024-08-27 08:33:38 -05:00
parent 790f4784ed
commit 6da5dd96d5

View File

@ -731,7 +731,7 @@ namespace ngcore
mem_to_delete = nullptr; mem_to_delete = nullptr;
} }
NETGEN_INLINE Array (Array && a2) NETGEN_INLINE Array (Array && a2) : allocsize(0)
{ {
mt.Swap(sizeof(T) * allocsize, a2.mt, sizeof(T) * a2.allocsize); mt.Swap(sizeof(T) * allocsize, a2.mt, sizeof(T) * a2.allocsize);