1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-17 22:38:33 +01:00

Merge pull request #315 from theli-ua/fix_leak

Do not allocate zero-sized arrays to stop leaking them. Fix new[]/delete mismatch
This commit is contained in:
Christian Muehlhaeuser 2015-09-01 07:03:11 +02:00
commit 35600021d7
2 changed files with 6 additions and 3 deletions

View File

@ -150,7 +150,7 @@ MediaStream::readDoneCallback ( const char *cookie, size_t bufferSize, void *buf
Q_UNUSED(bufferSize);
if ( ( m_type == Stream ) && buffer != nullptr && bufferSize > 0 ) {
delete static_cast< char* >( buffer );
delete[] reinterpret_cast< char* >( buffer );
}
return 0;

View File

@ -95,8 +95,11 @@ QNR_IODeviceStream::needData( void** buffer )
return 0;
}
*buffer = new char[data.size()];
memcpy(*buffer, data.data(), data.size());
if ( data.size() > 0 )
{
*buffer = new char[data.size()];
memcpy(*buffer, data.data(), data.size());
}
return data.size();
}