Skip to content

Commit 14afd20

Browse files
committed
SWIFT-1051 Fix memory leak in BSONDocumentIterator
1 parent ec67468 commit 14afd20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/MongoSwift/BSON/BSONDocumentIterator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class BSONDocumentIterator: IteratorProtocol {
3636

3737
let initialized = self.withMutableBSONIterPointer { iterPtr in
3838
self.document.withBSONPointer { docPtr in
39-
bson_iter_init_find(iterPtr, docPtr, key.cString(using: .utf8))
39+
bson_iter_init_find(iterPtr, docPtr, key)
4040
}
4141
}
4242

@@ -56,7 +56,7 @@ public class BSONDocumentIterator: IteratorProtocol {
5656
/// Moves the iterator to the specified key. Returns false if the key does not exist. Returns true otherwise.
5757
internal func move(to key: String) -> Bool {
5858
self.withMutableBSONIterPointer { iterPtr in
59-
bson_iter_find(iterPtr, key.cString(using: .utf8))
59+
bson_iter_find(iterPtr, key)
6060
}
6161
}
6262

0 commit comments

Comments
 (0)