mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-02 01:44:25 +01:00
Fixes per Vigilant Sentry (http://www.vigilantsw.com/)
* Fix memory leaks. * Add comments about initializations and checking for successful results. * Add checks for NULL deref. * Consistency in "TODO" vs "TO-DO" comments!
This commit is contained in:
@@ -282,7 +282,11 @@ void Importer::WriteImportItems()
|
||||
gPrefs->Write (name, val);
|
||||
}
|
||||
/* If we had more items than we have now, delete the excess */
|
||||
for (i = this->mExtImportItems->Count(); i >= 0; i++)
|
||||
// ANSWER-ME: Vigilant Sentry notes i is unsigned so (i >= 0) is always true.
|
||||
// If that's what you want, why not make the condition just be "true"? Or should it be an int?
|
||||
// But also, it looks like it's supposed to be a down-counting loop, so is i++ correct?
|
||||
// Rather, shouldn't i be set to this->mExtImportItems->Count() each time?
|
||||
for (i = this->mExtImportItems->Count(); i >= 0; i++)
|
||||
{
|
||||
name.Printf (wxT("/ExtImportItems/Item%d"), i);
|
||||
if (gPrefs->Read(name, &val))
|
||||
|
||||
@@ -467,13 +467,16 @@ int FLACImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
useOD=true;
|
||||
#endif
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
bool res = (mFile->process_until_end_of_file() != 0);
|
||||
#else
|
||||
bool res = true;
|
||||
if(!useOD)
|
||||
res = (mFile->process_until_end_of_stream() != 0);
|
||||
#endif
|
||||
// ANSWER-ME: Vigilant Sentry: Variable res unused after assignment (error code DA1)
|
||||
// Plus, it's not even declared in the LEGACY_FLAC clause
|
||||
//#ifdef LEGACY_FLAC
|
||||
// bool res = (mFile->process_until_end_of_file() != 0);
|
||||
//#else
|
||||
// bool res = true;
|
||||
// if(!useOD)
|
||||
// res = (mFile->process_until_end_of_stream() != 0);
|
||||
//#endif
|
||||
|
||||
//add the task to the ODManager
|
||||
if(useOD)
|
||||
{
|
||||
|
||||
@@ -53,6 +53,7 @@ bool ImportMIDI(wxString fName, NoteTrack * dest)
|
||||
if(new_seq->get_read_error() == alg_error_open){
|
||||
wxMessageBox( _("Could not open file ") + fName + wxT("."));
|
||||
mf.Close();
|
||||
delete new_seq;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user