Skip to content

Commit 147dc8c

Browse files
committed
usePinned V1877473314
1 parent e425de3 commit 147dc8c

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/PlatformNative.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ internal actual object SystemDefaultProvider : PlatformProvider {
4343
fseek(file, 0L, SEEK_SET)
4444

4545
// Read file content
46-
val buffer = ByteArray(size.toInt()).pin()
47-
val rc = fread(buffer.addressOf(0), 1uL, size.toULong(), file)
48-
if (rc == size.toULong()) buffer.get() else null
46+
ByteArray(size.toInt()).usePinned { buffer ->
47+
val rc = fread(buffer.addressOf(0), 1uL, size.toULong(), file)
48+
if (rc == size.toULong()) buffer.get() else null
49+
}
4950
} finally {
5051
fclose(file)
5152
}

0 commit comments

Comments
 (0)