From ffffde515f9152ddedbe68406258813ecc85e27b Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 27 Jun 2007 16:54:50 +0000 Subject: [PATCH] (svn r10356) -Fix (r10143): another memory leak eliminated. --- src/spritecache.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 4b46b224b2..710bca443d 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -283,6 +283,7 @@ void DupSprite(SpriteID old_spr, SpriteID new_spr) scnew->file_pos = scold->file_pos; scnew->ptr = NULL; scnew->id = scold->id; + free((char *)scnew->grf_name); scnew->grf_name = strdup(scold->grf_name); } @@ -493,6 +494,7 @@ void GfxInitSpriteMem() NextBlock(_spritecache_ptr)->size = 0; /* Reset the spritecache 'pool' */ + for (uint i = 0; i < _spritecache_items; i++) free((char *)_spritecache[i].grf_name); free(_spritecache); _spritecache_items = 0; _spritecache = NULL;