Fix: memory leak due to assigning result of strdup to a std::string

This commit is contained in:
Rubidium 2021-05-09 22:51:26 +02:00 committed by rubidium42
parent 79fc094c54
commit 296194ad36
3 changed files with 3 additions and 3 deletions

View File

@ -7394,7 +7394,7 @@ static void GRFInhibit(ByteReader *buf)
if (file != nullptr && file != _cur.grfconfig) {
grfmsg(2, "GRFInhibit: Deactivating file '%s'", file->filename);
GRFError *error = DisableGrf(STR_NEWGRF_ERROR_FORCEFULLY_DISABLED, file);
error->data = stredup(_cur.grfconfig->GetName());
error->data = _cur.grfconfig->GetName();
}
}
}

View File

@ -54,7 +54,7 @@ CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
si->y = y;
si->z = GetSlopePixelZ(x, y);
if (!StrEmpty(text)) {
si->name = stredup(text);
si->name = text;
}
si->UpdateVirtCoord();
InvalidateWindowData(WC_SIGN_LIST, 0, 0);

View File

@ -2004,7 +2004,7 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
old_generating_world.Restore();
if (t != nullptr && !StrEmpty(text)) {
t->name = stredup(text);
t->name = text;
t->UpdateVirtCoord();
}