mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Fix leaking file descriptors on error.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25431 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0d6828e064
commit
d6543b71af
2 changed files with 7 additions and 3 deletions
|
@ -207,10 +207,10 @@ bool EncRbSpeex::encode(QString input,QString output)
|
|||
}
|
||||
if ((fout = fopen(output.toLocal8Bit(), "wb")) == NULL) {
|
||||
qDebug() << "Error: could not open output file\n";
|
||||
fclose(fin);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int ret = encode_file(fin, fout, quality, complexity, narrowband, volume,
|
||||
errstr, sizeof(errstr));
|
||||
fclose(fout);
|
||||
|
|
|
@ -199,16 +199,19 @@ void VoiceFileCreator::downloadDone(bool error)
|
|||
return;
|
||||
}
|
||||
|
||||
FILE* output = fopen(QString(m_mountpoint + "/.rockbox/langs/" + m_lang + ".voice").toLocal8Bit(), "wb");
|
||||
FILE* output = fopen(QString(m_mountpoint + "/.rockbox/langs/" + m_lang
|
||||
+ ".voice").toLocal8Bit(), "wb");
|
||||
if (output == NULL)
|
||||
{
|
||||
cleanup();
|
||||
fclose(ids2);
|
||||
emit logItem(tr("Error opening output file"),LOGERROR);
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output);
|
||||
// ids2 and output are closed by voicefont().
|
||||
|
||||
//cleanup
|
||||
cleanup();
|
||||
|
@ -216,7 +219,8 @@ void VoiceFileCreator::downloadDone(bool error)
|
|||
// Add Voice file to the install log
|
||||
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
|
||||
installlog.beginGroup("selfcreated Voice");
|
||||
installlog.setValue("/.rockbox/langs/" + m_lang + ".voice",QDate::currentDate().toString("yyyyMMdd"));
|
||||
installlog.setValue("/.rockbox/langs/" + m_lang + ".voice",
|
||||
QDate::currentDate().toString("yyyyMMdd"));
|
||||
installlog.endGroup();
|
||||
installlog.sync();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue