Skip to content

Commit 00c39f6

Browse files
committed
usePinned V1877473314
1 parent 14b6e8c commit 00c39f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/util/SystemDefaultProviderBase.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ public abstract class SystemDefaultProviderBase : PlatformProvider {
2727

2828
try {
2929
// Read file content
30-
val buffer = ByteArray(size).pin()
31-
val rc = fread(buffer.addressOf(0), 1uL, size.toULong(), file)
32-
if (rc == size.toULong()) buffer.get() else null
30+
ByteArray(size).usePinned { buffer ->
31+
val rc = fread(buffer.addressOf(0), 1uL, size.toULong(), file)
32+
if (rc == size.toULong()) buffer.get() else null
33+
}
3334
} finally {
3435
fclose(file)
3536
}

0 commit comments

Comments
 (0)