Free SDL surface if 'TexPool::request' throws
This commit is contained in:
		
							parent
							
								
									ef2ed2fb32
								
							
						
					
					
						commit
						051c939f8d
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -143,7 +143,15 @@ Bitmap::Bitmap(const char *filename)
 | 
			
		|||
 | 
			
		||||
	p->ensureFormat(imgSurf, SDL_PIXELFORMAT_ABGR8888);
 | 
			
		||||
 | 
			
		||||
	try
 | 
			
		||||
	{
 | 
			
		||||
		tex = gState->texPool().request(imgSurf->w, imgSurf->h);
 | 
			
		||||
	}
 | 
			
		||||
	catch (const Exception &e)
 | 
			
		||||
	{
 | 
			
		||||
		SDL_FreeSurface(imgSurf);
 | 
			
		||||
		throw e;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	p = new BitmapPrivate;
 | 
			
		||||
	p->tex = tex;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue