Skip to content

Commit d859ad7

Browse files
sapierPilzAdam
sapier
authored andcommittedMay 10, 2013
Fix gettext memory leaks
1 parent ee1155f commit d859ad7

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎src/guiMainMenu.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -483,25 +483,31 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
483483
{
484484
core::rect<s32> rect(0, 0, 390, 20);
485485
rect += m_topleft_client + v2s32(50, 10);
486-
Environment->addStaticText(wgettext("Favorites:"),
486+
wchar_t* text = wgettext("Favorites:");
487+
Environment->addStaticText(text,
487488
rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
489+
delete[] text;
488490
}
489491
} else {
490492
m_data->servers = ServerList::getOnline();
491493
{
492494
core::rect<s32> rect(0, 0, 390, 20);
493495
rect += m_topleft_client + v2s32(50, 10);
494-
Environment->addStaticText(wgettext("Public Server List:"),
496+
wchar_t* text = wgettext("Public Server List:");
497+
Environment->addStaticText(text,
495498
rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
499+
delete[] text;
496500
}
497501
}
498502
#else
499503
m_data->servers = ServerList::getLocal();
500504
{
501505
core::rect<s32> rect(0, 0, 390, 20);
502506
rect += m_topleft_client + v2s32(50, 10);
503-
Environment->addStaticText(wgettext("Favorites:"),
507+
wchar_t* text = wgettext("Favorites:");
508+
Environment->addStaticText(text,
504509
rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
510+
delete[] text;
505511
}
506512
#endif
507513
updateGuiServerList();
@@ -1372,9 +1378,11 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
13721378
readInput(&cur);
13731379
if (getTab() == TAB_MULTIPLAYER && cur.address == L"")
13741380
{
1381+
wchar_t* text = wgettext("Address required.");
13751382
(new GUIMessageMenu(env, parent, -1, menumgr,
1376-
wgettext("Address required."))
1383+
text)
13771384
)->drop();
1385+
delete[] text;
13781386
return true;
13791387
}
13801388
acceptInput();

0 commit comments

Comments
 (0)
Please sign in to comment.