GLES2TextureBuffer::buildMipmaps memory leak

Minor issues with the Ogre API that can be trivial to fix
kctcynic
Gnoblar
Posts: 1
Joined: Wed Aug 31, 2011 8:33 pm

GLES2TextureBuffer::buildMipmaps memory leak

Post by kctcynic »

The scaled image data for the last level allocated gets leaked if there are multiple levels.

I fixed it locally by adding this to the end of the function.

Code: Select all

        if (level > 0) {
            OGRE_DELETE[] (uint8*) scaled.data;
            scaled.data = 0;
        }
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: GLES2TextureBuffer::buildMipmaps memory leak

Post by masterfalcon »

How about if we move the delete that exists to the end of the for loop?

Edit: Nevermind, you're right, it does need to be deleted outside the loop.