summaryrefslogtreecommitdiff
authorerik <erik>2007-01-31 22:21:38 (UTC)
committer erik <erik>2007-01-31 22:21:38 (UTC)
commited5fba8cdb27174427b2e7780508bafa05536ca1 (patch) (unidiff)
tree9dca5bd75617c8f18ba066bbd90ef88dc2473d84
parent9395cf2a65184e493714c699bb23b02ea31feef5 (diff)
downloadopie-ed5fba8cdb27174427b2e7780508bafa05536ca1.zip
opie-ed5fba8cdb27174427b2e7780508bafa05536ca1.tar.gz
opie-ed5fba8cdb27174427b2e7780508bafa05536ca1.tar.bz2
A few files that have dynamically allocated arrays that are not properly
de-allocated (forgot to use []).
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/modplug/load_amf.cpp2
-rw-r--r--core/multimedia/opieplayer/modplug/load_ams.cpp2
-rw-r--r--core/multimedia/opieplayer/modplug/load_mdl.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/modplug/load_amf.cpp b/core/multimedia/opieplayer/modplug/load_amf.cpp
index 188b5f5..2cf131b 100644
--- a/core/multimedia/opieplayer/modplug/load_amf.cpp
+++ b/core/multimedia/opieplayer/modplug/load_amf.cpp
@@ -381,40 +381,40 @@ BOOL CSoundFile::ReadAMF(LPCBYTE lpStream, DWORD dwMemLength)
381 } 381 }
382 // Create the patterns from the list of tracks 382 // Create the patterns from the list of tracks
383 for (UINT iPat=0; iPat<pfh->numorders; iPat++) 383 for (UINT iPat=0; iPat<pfh->numorders; iPat++)
384 { 384 {
385 MODCOMMAND *p = AllocatePattern(PatternSize[iPat], m_nChannels); 385 MODCOMMAND *p = AllocatePattern(PatternSize[iPat], m_nChannels);
386 if (!p) break; 386 if (!p) break;
387 Patterns[iPat] = p; 387 Patterns[iPat] = p;
388 for (UINT iChn=0; iChn<m_nChannels; iChn++) 388 for (UINT iChn=0; iChn<m_nChannels; iChn++)
389 { 389 {
390 UINT nTrack = ptracks[iPat][iChn]; 390 UINT nTrack = ptracks[iPat][iChn];
391 if ((nTrack) && (nTrack <= pfh->numtracks)) 391 if ((nTrack) && (nTrack <= pfh->numtracks))
392 { 392 {
393 UINT realtrk = pTrackMap[nTrack-1]; 393 UINT realtrk = pTrackMap[nTrack-1];
394 if (realtrk) 394 if (realtrk)
395 { 395 {
396 realtrk--; 396 realtrk--;
397 if ((realtrk < realtrackcnt) && (pTrackData[realtrk])) 397 if ((realtrk < realtrackcnt) && (pTrackData[realtrk]))
398 { 398 {
399 AMF_Unpack(p+iChn, pTrackData[realtrk], PatternSize[iPat], m_nChannels); 399 AMF_Unpack(p+iChn, pTrackData[realtrk], PatternSize[iPat], m_nChannels);
400 } 400 }
401 } 401 }
402 } 402 }
403 } 403 }
404 } 404 }
405 delete pTrackData; 405 delete [] pTrackData;
406 // Read Sample Data 406 // Read Sample Data
407 for (UINT iSeek=1; iSeek<=maxsampleseekpos; iSeek++) 407 for (UINT iSeek=1; iSeek<=maxsampleseekpos; iSeek++)
408 { 408 {
409 if (dwMemPos >= dwMemLength) break; 409 if (dwMemPos >= dwMemLength) break;
410 for (UINT iSmp=0; iSmp<m_nSamples; iSmp++) if (iSeek == sampleseekpos[iSmp]) 410 for (UINT iSmp=0; iSmp<m_nSamples; iSmp++) if (iSeek == sampleseekpos[iSmp])
411 { 411 {
412 MODINSTRUMENT *pins = &Ins[iSmp+1]; 412 MODINSTRUMENT *pins = &Ins[iSmp+1];
413 dwMemPos += ReadSample(pins, RS_PCM8U, (LPCSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos); 413 dwMemPos += ReadSample(pins, RS_PCM8U, (LPCSTR)(lpStream+dwMemPos), dwMemLength-dwMemPos);
414 break; 414 break;
415 } 415 }
416 } 416 }
417 return TRUE; 417 return TRUE;
418} 418}
419 419
420 420
diff --git a/core/multimedia/opieplayer/modplug/load_ams.cpp b/core/multimedia/opieplayer/modplug/load_ams.cpp
index 3dd1c2b..ad1cc01 100644
--- a/core/multimedia/opieplayer/modplug/load_ams.cpp
+++ b/core/multimedia/opieplayer/modplug/load_ams.cpp
@@ -605,27 +605,27 @@ void AMSUnpack(const char *psrc, UINT inputlen, char *pdest, UINT dmax, char pac
605 UINT bl = al & bitcount; 605 UINT bl = al & bitcount;
606 bl = ((bl|(bl<<8)) >> ((dh+8-count) & 7)) & 0xFF; 606 bl = ((bl|(bl<<8)) >> ((dh+8-count) & 7)) & 0xFF;
607 bitcount = ((bitcount|(bitcount<<8)) >> 1) & 0xFF; 607 bitcount = ((bitcount|(bitcount<<8)) >> 1) & 0xFF;
608 pdest[k++] |= bl; 608 pdest[k++] |= bl;
609 if (k >= dmax) 609 if (k >= dmax)
610 { 610 {
611 k = 0; 611 k = 0;
612 dh++; 612 dh++;
613 } 613 }
614 } 614 }
615 bitcount = ((bitcount|(bitcount<<8)) >> dh) & 0xFF; 615 bitcount = ((bitcount|(bitcount<<8)) >> dh) & 0xFF;
616 } 616 }
617 } 617 }
618 // Delta Unpack 618 // Delta Unpack
619 { 619 {
620 signed char old = 0; 620 signed char old = 0;
621 for (UINT i=0; i<dmax; i++) 621 for (UINT i=0; i<dmax; i++)
622 { 622 {
623 int pos = ((LPBYTE)pdest)[i]; 623 int pos = ((LPBYTE)pdest)[i];
624 if ((pos != 128) && (pos & 0x80)) pos = -(pos & 0x7F); 624 if ((pos != 128) && (pos & 0x80)) pos = -(pos & 0x7F);
625 old -= (signed char)pos; 625 old -= (signed char)pos;
626 pdest[i] = old; 626 pdest[i] = old;
627 } 627 }
628 } 628 }
629 delete amstmp; 629 delete [] amstmp;
630} 630}
631 631
diff --git a/core/multimedia/opieplayer/modplug/load_mdl.cpp b/core/multimedia/opieplayer/modplug/load_mdl.cpp
index 806b68b..e1f78d5 100644
--- a/core/multimedia/opieplayer/modplug/load_mdl.cpp
+++ b/core/multimedia/opieplayer/modplug/load_mdl.cpp
@@ -224,49 +224,49 @@ BOOL CSoundFile::ReadMDL(const BYTE *lpStream, DWORD dwMemLength)
224 pmib = (MDLINFOBLOCK *)(lpStream+dwMemPos); 224 pmib = (MDLINFOBLOCK *)(lpStream+dwMemPos);
225 memcpy(m_szNames[0], pmib->songname, 32); 225 memcpy(m_szNames[0], pmib->songname, 32);
226 norders = pmib->norders; 226 norders = pmib->norders;
227 if (norders > MAX_ORDERS) norders = MAX_ORDERS; 227 if (norders > MAX_ORDERS) norders = MAX_ORDERS;
228 m_nRestartPos = pmib->repeatpos; 228 m_nRestartPos = pmib->repeatpos;
229 m_nDefaultGlobalVolume = pmib->globalvol; 229 m_nDefaultGlobalVolume = pmib->globalvol;
230 m_nDefaultTempo = pmib->tempo; 230 m_nDefaultTempo = pmib->tempo;
231 m_nDefaultSpeed = pmib->speed; 231 m_nDefaultSpeed = pmib->speed;
232 m_nChannels = 4; 232 m_nChannels = 4;
233 for (i=0; i<32; i++) 233 for (i=0; i<32; i++)
234 { 234 {
235 ChnSettings[i].nVolume = 64; 235 ChnSettings[i].nVolume = 64;
236 ChnSettings[i].nPan = (pmib->channelinfo[i] & 0x7F) << 1; 236 ChnSettings[i].nPan = (pmib->channelinfo[i] & 0x7F) << 1;
237 if (pmib->channelinfo[i] & 0x80) 237 if (pmib->channelinfo[i] & 0x80)
238 ChnSettings[i].dwFlags |= CHN_MUTE; 238 ChnSettings[i].dwFlags |= CHN_MUTE;
239 else 239 else
240 m_nChannels = i+1; 240 m_nChannels = i+1;
241 } 241 }
242 for (j=0; j<norders; j++) Order[j] = pmib->seq[j]; 242 for (j=0; j<norders; j++) Order[j] = pmib->seq[j];
243 break; 243 break;
244 // ME: song message 244 // ME: song message
245 case 0x454D: 245 case 0x454D:
246 if (blocklen) 246 if (blocklen)
247 { 247 {
248 if (m_lpszSongComments) delete m_lpszSongComments; 248 if (m_lpszSongComments) delete [] m_lpszSongComments;
249 m_lpszSongComments = new char[blocklen]; 249 m_lpszSongComments = new char[blocklen];
250 if (m_lpszSongComments) 250 if (m_lpszSongComments)
251 { 251 {
252 memcpy(m_lpszSongComments, lpStream+dwMemPos, blocklen); 252 memcpy(m_lpszSongComments, lpStream+dwMemPos, blocklen);
253 m_lpszSongComments[blocklen-1] = 0; 253 m_lpszSongComments[blocklen-1] = 0;
254 } 254 }
255 } 255 }
256 break; 256 break;
257 // PA: Pattern Data 257 // PA: Pattern Data
258 case 0x4150: 258 case 0x4150:
259 npatterns = lpStream[dwMemPos]; 259 npatterns = lpStream[dwMemPos];
260 if (npatterns > MAX_PATTERNS) npatterns = MAX_PATTERNS; 260 if (npatterns > MAX_PATTERNS) npatterns = MAX_PATTERNS;
261 dwPos = dwMemPos + 1; 261 dwPos = dwMemPos + 1;
262 for (i=0; i<npatterns; i++) 262 for (i=0; i<npatterns; i++)
263 { 263 {
264 if (dwPos+18 >= dwMemLength) break; 264 if (dwPos+18 >= dwMemLength) break;
265 pmpd = (MDLPATTERNDATA *)(lpStream + dwPos); 265 pmpd = (MDLPATTERNDATA *)(lpStream + dwPos);
266 if (pmpd->channels > 32) break; 266 if (pmpd->channels > 32) break;
267 PatternSize[i] = pmpd->lastrow+1; 267 PatternSize[i] = pmpd->lastrow+1;
268 if (m_nChannels < pmpd->channels) m_nChannels = pmpd->channels; 268 if (m_nChannels < pmpd->channels) m_nChannels = pmpd->channels;
269 dwPos += 18 + 2*pmpd->channels; 269 dwPos += 18 + 2*pmpd->channels;
270 for (j=0; j<pmpd->channels; j++) 270 for (j=0; j<pmpd->channels; j++)
271 { 271 {
272 patterntracks[i*32+j] = pmpd->data[j]; 272 patterntracks[i*32+j] = pmpd->data[j];