String::Format_VA memory leaks #17405
Labels
bug
Something went wrong.
good first issue
Low hanging fruits good for people new to open source or OpenRCT2.
refactor
A task that will improve code readability, without changing outcome.
Operating System
Windows 10, 64 bit
OpenRCT2 build
OpenRCT2, v0.4.0-174-gc8df66f (c8df66f on develop) provided by GitHub
Describe the issue
The implementation of
String::Format_VA(mostly called from theString::Formatoverload without the buffer argument) allocates space for the string, and it's up to the user to free this (Memory::Free). This is however rarely done, instead it is mostly used as an argument for assignment to astd::string.OpenRCT2/src/openrct2/core/String.cpp
Lines 355 to 406 in 13db5a7
Since almost all cases use
std::stringalready, the best approach would be to return astd::stringor au8stringhere.Area(s) with issue?
Building the game
The text was updated successfully, but these errors were encountered: