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

Fix uninitialized variables, memory leaks #5495

Merged
merged 6 commits into from
Jan 27, 2023

Conversation

Web-eWorks
Copy link
Member

I've run AddressSanitizer, LeakSanitizer, and ThreadSanitizer on the code (as well as a brief pass with Valgrind) to clean up any possible issues or errors that might have been introduced without notice.

This PR fixes, in total:

  • 1 read-past-end bug (in DistanceFieldFont.cpp)
  • 2 uninitialized variable accesses (in scenegraph/Model.cpp and ship/ShipViewController.cpp)
  • 3 memory leaks, of varying severity between a few hundred bytes and 600kb

- starts_with was being passed an invalid C string pointer
- instead, work on std::string_view the entire way
- Several hundreds of refs were leaking their m_copycount values, at 4 bytes per allocation
- GenFaceQuad request (and its owned resources including material instance) were never freed
- The edge index list was permanently leaked every time a GeomTree was constructed
@impaktor
Copy link
Member

Could any of these explain some of the reported bugs on Lua side?
(Just checking if I should add a sub-routine to my brain when hunting reported bugs that says "this might have been fixed in master")

@Web-eWorks
Copy link
Member Author

Very unlikely - these are all in C++. The only thing that even comes close to Lua memory was the LuaRef bug, and that was entirely benign other than leaking unused memory.

@Web-eWorks Web-eWorks merged commit 80bcd36 into pioneerspacesim:master Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants