summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2012-02-29 20:09:51 +0100
committerThomas Jarosch <tomj@simonv.com>2012-02-29 20:13:17 +0100
commite8c7d10e4662c3c1d26a7500914f1ce7fdce99d4 (patch)
tree683129fd6a449a950b6aa278f208be32bdd4ecae
parent29c72591fd5c761d7a92c11d682f28599cc1ed9e (diff)
downloadrockbox-e8c7d10e4662c3c1d26a7500914f1ce7fdce99d4.tar.gz
rockbox-e8c7d10e4662c3c1d26a7500914f1ce7fdce99d4.zip
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
-rw-r--r--rbutil/rbutilqt/base/encoderlame.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/rbutil/rbutilqt/base/encoderlame.cpp b/rbutil/rbutilqt/base/encoderlame.cpp
index 8950d416c9..9550eb5681 100644
--- a/rbutil/rbutilqt/base/encoderlame.cpp
+++ b/rbutil/rbutilqt/base/encoderlame.cpp
@@ -181,7 +181,7 @@ bool EncoderLame::encode(QString input,QString output)
181 channels = buf[2] | buf[3]<<8; 181 channels = buf[2] | buf[3]<<8;
182 samplerate = buf[4] | buf[5]<<8 | buf[6]<<16 | buf[7]<<24; 182 samplerate = buf[4] | buf[5]<<8 | buf[6]<<16 | buf[7]<<24;
183 samplesize = buf[14] | buf[15]<<8; 183 samplesize = buf[14] | buf[15]<<8;
184 delete buf; 184 delete[] buf;
185 } 185 }
186 } 186 }
187 // read data 187 // read data
@@ -252,8 +252,8 @@ bool EncoderLame::encode(QString input,QString output)
252 else { 252 else {
253 qDebug() << "[EncoderLame] Unknown samplesize:" << samplesize; 253 qDebug() << "[EncoderLame] Unknown samplesize:" << samplesize;
254 fin.close(); 254 fin.close();
255 delete mp3buf; 255 delete[] mp3buf;
256 delete wavbuf; 256 delete[] wavbuf;
257 return false; 257 return false;
258 } 258 }
259#else 259#else
@@ -270,8 +270,8 @@ bool EncoderLame::encode(QString input,QString output)
270 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) { 270 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
271 qDebug() << "[EncoderLame] Writing mp3 data failed!" << ret; 271 qDebug() << "[EncoderLame] Writing mp3 data failed!" << ret;
272 fout.close(); 272 fout.close();
273 delete mp3buf; 273 delete[] mp3buf;
274 delete wavbuf; 274 delete[] wavbuf;
275 return false; 275 return false;
276 } 276 }
277 // flush remaining data 277 // flush remaining data
@@ -279,15 +279,15 @@ bool EncoderLame::encode(QString input,QString output)
279 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) { 279 if(fout.write((char*)mp3buf, ret) != (unsigned int)ret) {
280 qDebug() << "[EncoderLame] Writing final mp3 data failed!"; 280 qDebug() << "[EncoderLame] Writing final mp3 data failed!";
281 fout.close(); 281 fout.close();
282 delete mp3buf; 282 delete[] mp3buf;
283 delete wavbuf; 283 delete[] wavbuf;
284 return false; 284 return false;
285 } 285 }
286 // shut down encoder and clean up. 286 // shut down encoder and clean up.
287 m_lame_close(gfp); 287 m_lame_close(gfp);
288 fout.close(); 288 fout.close();
289 delete mp3buf; 289 delete[] mp3buf;
290 delete wavbuf; 290 delete[] wavbuf;
291 291
292 return true; 292 return true;
293} 293}