Skip to content

Commit

Permalink
cppcheck: Prevent arithmetic on a nullptr.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdude42 committed Apr 8, 2019
1 parent 8286930 commit 75883e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/recorders/DeviceReadBuffer.cpp
Expand Up @@ -83,16 +83,17 @@ bool DeviceReadBuffer::Setup(const QString &streamName, int streamfd,
m_buffer = new (nothrow) unsigned char[m_size + m_dev_read_size];
m_readPtr = m_buffer;
m_writePtr = m_buffer;
m_endPtr = m_buffer + m_size;

// Initialize buffer, if it exists
if (!m_buffer)
{
m_endPtr = nullptr;
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Failed to allocate buffer of size %1 = %2 + %3")
.arg(m_size+m_dev_read_size).arg(m_size).arg(m_dev_read_size));
return false;
}
m_endPtr = m_buffer + m_size;
memset(m_buffer, 0xFF, m_size + m_read_quanta);

// Initialize statistics
Expand Down

0 comments on commit 75883e2

Please sign in to comment.