Skip to content

Commit

Permalink
Return NULL when asking for 0 bytes with MM_ALLOC (#2986)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasp00 authored Aug 21, 2016
1 parent 6e1e632 commit c5cc89d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/core/MemoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down

0 comments on commit c5cc89d

Please sign in to comment.