fixed many undetected memory leaks in trurl #233
Merged
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.
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 thestruct 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.