1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Remove some calls to free (#17577)

This commit is contained in:
Raymond Zhao
2022-07-20 23:50:43 -07:00
committed by GitHub
parent ed18ef1146
commit f4df6be8ae
2 changed files with 7 additions and 6 deletions

View File

@@ -13,6 +13,7 @@
#include <openrct2/Game.h>
#include <openrct2/actions/NetworkModifyGroupAction.h>
#include <openrct2/config/Config.h>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/network/network.h>
@@ -347,9 +348,9 @@ static ScreenCoordsXY WindowMultiplayerInformationGetSize()
// Server name is displayed word-wrapped, so figure out how high it will be.
{
utf8* buffer = _strdup(network_get_server_name());
utf8* buffer = String::Duplicate(network_get_server_name());
gfx_wrap_string(buffer, width, FontSpriteBase::MEDIUM, &numLines);
free(buffer);
delete buffer;
height += ++numLines * lineHeight + (LIST_ROW_HEIGHT / 2);
}
@@ -357,9 +358,9 @@ static ScreenCoordsXY WindowMultiplayerInformationGetSize()
const utf8* descString = network_get_server_description();
if (!str_is_null_or_empty(descString))
{
utf8* buffer = _strdup(descString);
utf8* buffer = String::Duplicate(descString);
gfx_wrap_string(buffer, width, FontSpriteBase::MEDIUM, &numLines);
free(buffer);
delete buffer;
height += ++numLines * lineHeight + (LIST_ROW_HEIGHT / 2);
}

View File

@@ -241,8 +241,8 @@ public:
// Dispose track list
for (auto& trackDesign : _trackDesigns)
{
free(trackDesign.name);
free(trackDesign.path);
delete trackDesign.name;
delete trackDesign.path;
}
_trackDesigns.clear();