1
0
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:
v.audacity
2012-02-08 05:09:14 +00:00
parent 5b3f3f71ea
commit 5f5b9778de
23 changed files with 83 additions and 34 deletions

View File

@@ -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))

View File

@@ -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)
{

View File

@@ -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;
}