Return NULL when asking for 0 bytes with MM_ALLOC (#2986)

This commit is contained in:
Javier Serrano Polo
2016-08-21 23:24:53 +00:00
committed by GitHub
parent 6e1e632baf
commit c5cc89d691
2 changed files with 6 additions and 3 deletions

View File

@@ -50,6 +50,11 @@ bool MemoryManager::init()
void * MemoryManager::alloc( size_t size )
{
if( !size )
{
return NULL;
}
int requiredChunks = size / MM_CHUNK_SIZE + ( size % MM_CHUNK_SIZE > 0 ? 1 : 0 );
MemoryPool * mp = NULL;

View File

@@ -151,9 +151,7 @@ SampleBuffer::SampleBuffer( const f_cnt_t _frames ) :
SampleBuffer::~SampleBuffer()
{
if( m_origData != NULL )
MM_FREE( m_origData );
MM_FREE( m_origData );
MM_FREE( m_data );
}