Remove some calls to free (#17577)

This commit is contained in:
Raymond Zhao authored and GitHub committed 2022-07-21 07:50:43 +01:00
1 parent ed18ef1146
commit f4df6be8ae
2 files changed
+7 -6

No files matched your search

+5 -4
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);
}
+2 -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();