Memory leak SDL while using SDL_CreateTextureFromS

2019-02-28 16:09发布

I'm learning SDL and I've noticed that I have memory leak when I have this line in my code:

m_TextureMap["napis"]= SDL_CreateTextureFromSurface( getRenderer(), textSurface );

I have SDL_FreeSurface(textSurface); right after the first one.

When I comment out only this line, there's no memory leak.

What am I doing wrong? Is there anything else I need to clean except for SDL_FreeSurface(textSurface) ?

P.S. getRenderer is function that returns global SDL renderer, I use this function a lot in other places and I'm sure it doesn't cause leak.

m_TextureMap is just a map where I store textures

textSurface is pointer to SDL_Surface

0条回答
登录 后发表回答