Game Development Community

BUG: Memory Leak in Resource Manager

by David Wyand · in Torque Game Engine · 08/06/2004 (6:47 am) · 1 replies

Greetings!

I've come across a minor memory leak in the resource manager. A buffer used to store a file pathway is not being deleted after a particular error. In core/resManager.cc, find the ResManager::setModZip() method. Here's what's there now:

// Setup the resource for the zip contents
         // ..now open the volume and add all its resources to the dictionary
         ZipAggregate zipAggregate;
         if (zipAggregate.openAggregate(zip->zipName) == false)
         {
            return false;
         }

And here's the fix (bolded):

// Setup the resource for the zip contents
         // ..now open the volume and add all its resources to the dictionary
         ZipAggregate zipAggregate;
         if (zipAggregate.openAggregate(zip->zipName) == false)
         {
            [b]delete [] modPath; // DAW: Line added[/b]
            return false;
         }

Enjoy!

- LightWave Dave

About the author

A long time Associate of the GarageGames' community and author of the Torque 3D Game Development Cookbook. Buy it today from Packt Publishing!


#1
08/11/2004 (8:16 pm)
Checked this fix in.

Good eye, Dave.