Changeset - r25428:48f543d34f61
[Not reviewed]
master
0 3 0
Rubidium - 3 years ago 2021-05-09 20:51:26
rubidium@openttd.org
Fix: memory leak due to assigning result of strdup to a std::string
3 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -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();
 
		}
 
	}
 
}
src/signs_cmd.cpp
Show inline comments
 
@@ -54,7 +54,7 @@ CommandCost CmdPlaceSign(TileIndex tile,
 
		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);
src/town_cmd.cpp
Show inline comments
 
@@ -2004,7 +2004,7 @@ CommandCost CmdFoundTown(TileIndex tile,
 
		old_generating_world.Restore();
 

	
 
		if (t != nullptr && !StrEmpty(text)) {
 
			t->name = stredup(text);
 
			t->name = text;
 
			t->UpdateVirtCoord();
 
		}
 

	
0 comments (0 inline, 0 general)