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

pkg/uzlib: warn about memory leak during compression #20293

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/uzlib/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* @ingroup sys_compression
* @brief Deflate/Zlib-compatible LZ77 compression/decompression library
*
* @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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and it should be possible to fix this with a simple git patch or upstream PR.

*
* # License
*
* Licensed under zlib.
Expand Down
Loading