From f500be5e1abec497e77c17f130262e5c518ce4d8 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Mon, 5 Aug 2024 11:17:22 -0700 Subject: [PATCH] fix tests --- Source/AwsCommonRuntimeKit/crt/Utilities.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/AwsCommonRuntimeKit/crt/Utilities.swift b/Source/AwsCommonRuntimeKit/crt/Utilities.swift index 2bb3f691..360a1711 100644 --- a/Source/AwsCommonRuntimeKit/crt/Utilities.swift +++ b/Source/AwsCommonRuntimeKit/crt/Utilities.swift @@ -275,10 +275,10 @@ func withByteCursorFromStrings( extension Array where Element == String { func withByteCursorArray(_ body: (UnsafePointer, Int) -> R) -> R { - let cStrings = self.map { strdup($0) } + [nil] + let len = self.count + let cStrings = self.map { strdup($0) } let cursors = cStrings.map { aws_byte_cursor_from_c_str($0) } - let len = cursors.count - + defer { cStrings.forEach { free($0) } }