Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GdalXmlNode::fmt(): use explicit VSIFree() #2

Open
wants to merge 4 commits into
base: feature/warp
Choose a base branch
from

Conversation

rouault
Copy link

@rouault rouault commented Dec 29, 2023

While reviewing the code, I was wondering if it wasn't leaking, but it seems not in practice. However using CString::from_raw() seems a bit dangerous and relies on non specified behaviour, as the documentation of that function mentions 'Retakes ownership of a CString that was transferred to C via CString::into_raw', which isn't the case here. The fact that it worked in practice comes from the fact the default deallocator used behind the scenes by CString is free(), and that VSIFree() is also an alias for that.

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

metasim and others added 4 commits December 27, 2023 15:16
While reviewing the code, I was wondering if it wasn't leaking, but it
seems not in practice. However using CString::from_raw() seems a bit
dangerous and relies on non specified behaviour, as the documentation of
that function mentions 'Retakes ownership of a CString that was
transferred to C via CString::into_raw', which isn't the case here.
The fact that it worked in practice comes from the fact the default
deallocator used behind the scenes by CString is free(), and
that VSIFree() is also an alias for that.
@metasim metasim force-pushed the feature/warp branch 3 times, most recently from b3d68e3 to a16e93b Compare January 5, 2024 20:51
@metasim metasim force-pushed the feature/warp branch 2 times, most recently from 576c57a to 74edd48 Compare February 1, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants