forked from len0rd/rockbox
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;
|
channels = buf[2] | buf[3]<<8;
|
||||||
samplerate = buf[4] | buf[5]<<8 | buf[6]<<16 | buf[7]<<24;
|
samplerate = buf[4] | buf[5]<<8 | buf[6]<<16 | buf[7]<<24;
|
||||||
samplesize = buf[14] | buf[15]<<8;
|
samplesize = buf[14] | buf[15]<<8;
|
||||||
delete buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// read data
|
// read data
|
||||||
|
@ -252,8 +252,8 @@ bool EncoderLame::encode(QString input,QString output)
|
||||||
else {
|
else {
|
||||||
qDebug() << "[EncoderLame] Unknown samplesize:" << samplesize;
|
qDebug() << "[EncoderLame] Unknown samplesize:" << samplesize;
|
||||||
fin.close();
|
fin.close();
|
||||||
delete mp3buf;
|
delete[] mp3buf;
|
||||||
delete wavbuf;
|
delete[] wavbuf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -270,8 +270,8 @@ bool EncoderLame::encode(QString input,QString output)
|
||||||
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
|
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
|
||||||
qDebug() << "[EncoderLame] Writing mp3 data failed!" << ret;
|
qDebug() << "[EncoderLame] Writing mp3 data failed!" << ret;
|
||||||
fout.close();
|
fout.close();
|
||||||
delete mp3buf;
|
delete[] mp3buf;
|
||||||
delete wavbuf;
|
delete[] wavbuf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// flush remaining data
|
// flush remaining data
|
||||||
|
@ -279,15 +279,15 @@ bool EncoderLame::encode(QString input,QString output)
|
||||||
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
|
if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
|
||||||
qDebug() << "[EncoderLame] Writing final mp3 data failed!";
|
qDebug() << "[EncoderLame] Writing final mp3 data failed!";
|
||||||
fout.close();
|
fout.close();
|
||||||
delete mp3buf;
|
delete[] mp3buf;
|
||||||
delete wavbuf;
|
delete[] wavbuf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// shut down encoder and clean up.
|
// shut down encoder and clean up.
|
||||||
m_lame_close(gfp);
|
m_lame_close(gfp);
|
||||||
fout.close();
|
fout.close();
|
||||||
delete mp3buf;
|
delete[] mp3buf;
|
||||||
delete wavbuf;
|
delete[] wavbuf;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue