Skip to content

Commit

Permalink
SWIFT-1051 Fix memory leak in BSONDocumentIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
kmahar committed Jan 13, 2021
1 parent ec67468 commit 14afd20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/MongoSwift/BSON/BSONDocumentIterator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class BSONDocumentIterator: IteratorProtocol {

let initialized = self.withMutableBSONIterPointer { iterPtr in
self.document.withBSONPointer { docPtr in
bson_iter_init_find(iterPtr, docPtr, key.cString(using: .utf8))
bson_iter_init_find(iterPtr, docPtr, key)
}
}

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

Expand Down

0 comments on commit 14afd20

Please sign in to comment.