Skip to content

Commit

Permalink
Bug: iterator lifetime not tied to result
Browse files Browse the repository at this point in the history
This can lead to the underlying data being dropped before the
data from the iterator has been used, which can lead to crashes.

Signed-off-by: Keith Wansbrough <kwansbrough@microsoft.com>
  • Loading branch information
kw217 committed Feb 2, 2024
1 parent 9698afb commit 79ed5c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cassandra/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl CassResult {

/// Creates a new iterator for the specified result. This can be
/// used to iterate over rows in the result.
pub fn iter(&self) -> ResultIterator {
pub fn iter<'a>(&'a self) -> ResultIterator<'a> {
unsafe {
ResultIterator(
cass_iterator_from_result(self.0),
Expand Down

0 comments on commit 79ed5c8

Please sign in to comment.