Fix (harmless) use-after-free in zone.c.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Mar 2015 17:30:16 +0000 (17:30 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Mar 2015 17:30:16 +0000 (17:30 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12186 d7cf8633-e32d-0410-b094-e92efae38249

zone.c

diff --git a/zone.c b/zone.c
index 2c72c11..fe80693 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -558,9 +558,11 @@ void _Mem_FreePool(mempool_t **poolpointer, const char *filename, int fileline)
                        _Mem_FreeBlock(pool->chain, filename, fileline);
 
                // free child pools, too
-               for(iter = poolchain; iter; temp = iter = iter->next)
+               for(iter = poolchain; iter; iter = temp) {
+                       temp = iter->next;
                        if(iter->parent == pool)
                                _Mem_FreePool(&temp, filename, fileline);
+               }
 
                // free the pool itself
                Clump_FreeBlock(pool, sizeof(*pool));