Memory leak SDL while using SDL_CreateTextureFromSurface
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