pkg/uzlib: warn about memory leak during compression#20293
Merged
Teufelchen1 merged 1 commit intoRIOT-OS:masterfrom Jan 24, 2024
Merged
pkg/uzlib: warn about memory leak during compression#20293Teufelchen1 merged 1 commit intoRIOT-OS:masterfrom
Teufelchen1 merged 1 commit intoRIOT-OS:masterfrom
Conversation
maribu
approved these changes
Jan 24, 2024
benpicco
reviewed
Jan 29, 2024
| * | ||
| * @warning During compression, uzlib allocates memory on the heap without freeing it. | ||
| * Do not use this package in production code! | ||
| * See https://github.com/pfalcon/uzlib/issues/41#issuecomment-1907807048 |
Contributor
There was a problem hiding this comment.
That sounds a lot scarier than it is, AFAIU the API is just a bit bad in that it allocates the memory on it's own and int a bit of an opaque location, but it's the outbuf that then contains the result of the compression.
So it should be enough if we free free(comp.out.outbuf) once we are done with it, right?
Contributor
Author
There was a problem hiding this comment.
Yes, and it should be possible to fix this with a simple git patch or upstream PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
uzlib (zlib-compatible compression/decompression) contains a memory leak during compression. Add a warning to the documentation until the issue is resolved upstream, see pfalcon/uzlib#41 (comment)