Skip to content

Commit

Permalink
Fix use-after-free in Dataset::close
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Jul 5, 2023
1 parent 26236ba commit 8bea21e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changes

## Unreleased
- `Dataset::close` now consumes `self`

- <https://github.com/georust/gdal/pull/420>

- Fixed build error with GDAL 3.1

- <https://github.com/georust/gdal/pull/416>
Expand Down
2 changes: 1 addition & 1 deletion src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl Dataset {
/// See [`GDALClose`].
///
/// Note: on GDAL versions older than 3.7, this function always succeeds.
pub fn close(&mut self) -> Result<()> {
pub fn close(self) -> Result<()> {
#[cfg(any(all(major_ge_3, minor_ge_7), major_ge_4))]
{
let rv = unsafe { gdal_sys::GDALClose(self.c_dataset) };
Expand Down

0 comments on commit 8bea21e

Please sign in to comment.