forked from Bananymous/banan-os
				
			BAN: RefCounted<> frees count if object allocation fails
This commit is contained in:
		
							parent
							
								
									d5f302a68b
								
							
						
					
					
						commit
						e480f9c195
					
				| 
						 | 
				
			
			@ -84,7 +84,10 @@ namespace BAN
 | 
			
		|||
				return Error::from_errno(ENOMEM);
 | 
			
		||||
			T* data = new T(forward<Args>(args)...);
 | 
			
		||||
			if (!data)
 | 
			
		||||
			{
 | 
			
		||||
				delete count;
 | 
			
		||||
				return Error::from_errno(ENOMEM);
 | 
			
		||||
			}
 | 
			
		||||
			return RefCounted<T>(data, count);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue