Fix mismatching C++ new[] / delete calls
cppcheck report: [rbutil/rbutilqt/base/encoderlame.cpp:273]: (error) Mismatching allocation and deallocation: mp3buf [rbutil/rbutilqt/base/encoderlame.cpp:282]: (error) Mismatching allocation and deallocation: mp3buf [rbutil/rbutilqt/base/encoderlame.cpp:289]: (error) Mismatching allocation and deallocation: mp3buf [rbutil/rbutilqt/base/encoderlame.cpp:274]: (error) Mismatching allocation and deallocation: wavbuf [rbutil/rbutilqt/base/encoderlame.cpp:283]: (error) Mismatching allocation and deallocation: wavbuf [rbutil/rbutilqt/base/encoderlame.cpp:290]: (error) Mismatching allocation and deallocation: wavbuf [rbutil/rbutilqt/base/encoderlame.cpp:184]: (error) Mismatching allocation and deallocation: buf Change-Id: I9fd54b6e02817eb900ec6e24d967da6d4beaeb27
This commit is contained in:
parent
29c72591fd
commit
e8c7d10e46
1 changed files with 9 additions and 9 deletions
|
@ -181,7 +181,7 @@ bool EncoderLame::encode(QString input,QString output)
|
|||
channels = buf[2] | buf[3]<<8;
|
||||
samplerate = buf[4] | buf[5]<<8 | buf[6]<<16 | buf[7]<<24;
|
||||
samplesize = buf[14] | buf[15]<<8;
|
||||
delete buf;
|
||||
delete[] buf;
|
||||
}
|
||||
}
|
||||
// read data
|
||||
|
@ -252,8 +252,8 @@ bool EncoderLame::encode(QString input,QString output)
|
|||
else {
|
||||
qDebug() << "[EncoderLame] Unknown samplesize:" << samplesize;
|
||||
fin.close();
|
||||
delete mp3buf;
|
||||
delete wavbuf;
|
||||
delete[] mp3buf;
|
||||
delete[] wavbuf;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
|
@ -270,8 +270,8 @@ bool EncoderLame::encode(QString input,QString output)
|
|||
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
|
||||
qDebug() << "[EncoderLame] Writing mp3 data failed!" << ret;
|
||||
fout.close();
|
||||
delete mp3buf;
|
||||
delete wavbuf;
|
||||
delete[] mp3buf;
|
||||
delete[] wavbuf;
|
||||
return false;
|
||||
}
|
||||
// flush remaining data
|
||||
|
@ -279,15 +279,15 @@ bool EncoderLame::encode(QString input,QString output)
|
|||
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
|
||||
qDebug() << "[EncoderLame] Writing final mp3 data failed!";
|
||||
fout.close();
|
||||
delete mp3buf;
|
||||
delete wavbuf;
|
||||
delete[] mp3buf;
|
||||
delete[] wavbuf;
|
||||
return false;
|
||||
}
|
||||
// shut down encoder and clean up.
|
||||
m_lame_close(gfp);
|
||||
fout.close();
|
||||
delete mp3buf;
|
||||
delete wavbuf;
|
||||
delete[] mp3buf;
|
||||
delete[] wavbuf;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue