Skip to content

Commit 54dfc5a

Browse files
committed
[Unit testing] Fix two testing bugs found by valgrind
1 parent c5b7e7f commit 54dfc5a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

unittests/runtime/Array.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extern "C" void swift_arrayInitWithCopy(OpaqueValue *dest,
4343

4444
#define COPY_POD_TEST(kind) \
4545
ValueWitnessTable pod_witnesses; \
46+
memset(&pod_witnesses, 0, sizeof(pod_witnesses)); \
4647
initialize_pod_witness_table_size_uint32_t_stride_uint64_t(pod_witnesses); \
4748
uint64_t srcArray[3] = {0, 1, 2}; \
4849
uint64_t destArray[3] = {0x5A5A5A5AU, 0x5A5A5A5AU, 0x5A5A5A5AU}; \
@@ -296,6 +297,7 @@ extern "C" void swift_arrayDestroy(OpaqueValue *begin, size_t count,
296297

297298
TEST(TestArrayCopy, test_swift_arrayDestroyPOD) {
298299
ValueWitnessTable pod_witnesses;
300+
memset(&pod_witnesses, 0, sizeof(pod_witnesses));
299301
initialize_pod_witness_table_size_uint32_t_stride_uint64_t(pod_witnesses);
300302
uint64_t array[3] = {0, 1, 2};
301303
FullOpaqueMetadata testMetadata = {{&pod_witnesses},

0 commit comments

Comments
 (0)