(svn r12005) -Fix [FS#1717]: possible reading from an invalid pointer. Patch by PhilSophus.
authorrubidium
Tue, 29 Jan 2008 00:29:28 +0000
changeset 8931 d84c34673a0f
parent 8930 361433723616
child 8932 989fe2280933
(svn r12005) -Fix [FS#1717]: possible reading from an invalid pointer. Patch by PhilSophus.
src/spritecache.cpp
--- a/src/spritecache.cpp	Tue Jan 29 00:27:25 2008 +0000
+++ b/src/spritecache.cpp	Tue Jan 29 00:29:28 2008 +0000
@@ -262,8 +262,8 @@
 
 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;