curl / trurl

trurl is a command line tool for URL parsing and manipulation.
https://curl.se/trurl/
Other
3.15k stars 102 forks source link

fixed many undetected memory leaks in trurl #233

Closed jacobmealey closed 1 year ago

jacobmealey commented 1 year ago

This PR adds a heap of fixes to undetected memory errors in trurl. These memory errors were discovered by building trurl against a debug version of libcurl and running make test-memory which discovered 55 memory errors on my machine. This PR doesn't fix all of them, but it does fix most of them.

When running on my machine there are 2 tests which fail, both of which are a --verify test with early exits where the error message includes some string that was dynamically allocated. These two are tricky to fix with out reworking all of the error handling system. A simple fix is propagating the struct option to every function that could error and have the error function clean up the option struct after printing, this seems like a gross solution though and I thought that it should probably be thought over more and done in a separate PR.