replace delete with delete[]

This commit is contained in:
MPR 2014-10-18 17:50:21 +00:00
parent 4b23730e86
commit 0521316285
2 changed files with 9 additions and 4 deletions

View File

@ -36,6 +36,8 @@ class V4L2DeviceSource: public FramedSource
struct Frame
{
Frame(char* buffer, int size, timeval timestamp) : m_buffer(buffer), m_size(size), m_timestamp(timestamp) {};
Frame(const Frame&);
Frame& operator=(const Frame&);
~Frame() { delete m_buffer; };
char* m_buffer;

View File

@ -149,7 +149,7 @@ void V4L2DeviceSource::deliverFrame()
}
fFrameSize -= offset;
memcpy(fTo, frame->m_buffer+offset, fFrameSize);
delete frame;
delete [] frame;
}
// send Frame to the consumer
@ -168,13 +168,13 @@ void V4L2DeviceSource::getNextFrame()
if (frameSize < 0)
{
envir() << "V4L2DeviceSource::getNextFrame errno:" << errno << " " << strerror(errno) << "\n";
delete buffer;
delete [] buffer;
handleClosure(this);
}
else if (frameSize == 0)
{
envir() << "V4L2DeviceSource::getNextFrame no data errno:" << errno << " " << strerror(errno) << "\n";
delete buffer;
delete [] buffer;
}
else
{
@ -192,6 +192,10 @@ void V4L2DeviceSource::getNextFrame()
{
queueFrame(buffer,frameSize,ref);
}
else
{
delete [] buffer;
}
}
}
@ -263,7 +267,6 @@ bool V4L2DeviceSource::processConfigrationFrame(char * frame, int frameSize)
std::cout << "AuxLine:" << m_auxLine << " \n";
}
ret = true;
delete [] frame;
}
}