summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-29 00:29:28 +0000
committerrubidium <rubidium@openttd.org>2008-01-29 00:29:28 +0000
commit7c310600ba92764f7ff970fd6fb9c1836800024a (patch)
tree36481130a8ab6c19479309997e82f64e5631a163
parent1b7051768c65fe2886f1a562f5741a1e2d9acd11 (diff)
downloadopenttd-7c310600ba92764f7ff970fd6fb9c1836800024a.tar.xz
(svn r12005) -Fix [FS#1717]: possible reading from an invalid pointer. Patch by PhilSophus.
-rw-r--r--src/spritecache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 1ea6816a7..2533a6b11 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -262,8 +262,8 @@ bool LoadNextSprite(int load_index, byte file_slot, uint file_sprite_id)
void DupSprite(SpriteID old_spr, SpriteID new_spr)
{
+ SpriteCache *scnew = AllocateSpriteCache(new_spr); // may reallocate: so put it first
SpriteCache *scold = GetSpriteCache(old_spr);
- SpriteCache *scnew = AllocateSpriteCache(new_spr);
scnew->file_slot = scold->file_slot;
scnew->file_pos = scold->file_pos;