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:
commit
35600021d7
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user