Skip to content

Fix free calls #44

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

Merged
merged 1 commit into from
Feb 18, 2025
Merged

Fix free calls #44

merged 1 commit into from
Feb 18, 2025

Conversation

thomasjm
Copy link
Contributor

I found that this library was crashing on Windows due to using the incorrect free when I called the get function.

As the LevelDB header file says (see here), it's important to free the memory returned from LevelDB using the same allocator that produced it. For this reason, LevelDB provides the C leveldb_free function.

I don't think this causes problems on Linux (although maybe there are subtle security implications?). But the free from Foreign.Alloc.Marshal in Haskell on Windows must use a different allocator because I always get an immediate crash.

@kim kim merged commit 229422e into kim:master Feb 18, 2025
4 checks passed
@kim
Copy link
Owner

kim commented Feb 18, 2025

Thanks!

@thomasjm
Copy link
Contributor Author

Could I trouble you to do a Hackage release with this fix?

@kim
Copy link
Owner

kim commented Feb 25, 2025

Version 0.6.5.1 was uploaded to Hackage

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