mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -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) {
|
if ((fout = fopen(output.toLocal8Bit(), "wb")) == NULL) {
|
||||||
qDebug() << "Error: could not open output file\n";
|
qDebug() << "Error: could not open output file\n";
|
||||||
|
fclose(fin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ret = encode_file(fin, fout, quality, complexity, narrowband, volume,
|
int ret = encode_file(fin, fout, quality, complexity, narrowband, volume,
|
||||||
errstr, sizeof(errstr));
|
errstr, sizeof(errstr));
|
||||||
fclose(fout);
|
fclose(fout);
|
||||||
|
|
|
@ -199,16 +199,19 @@ void VoiceFileCreator::downloadDone(bool error)
|
||||||
return;
|
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)
|
if (output == NULL)
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
fclose(ids2);
|
||||||
emit logItem(tr("Error opening output file"),LOGERROR);
|
emit logItem(tr("Error opening output file"),LOGERROR);
|
||||||
emit done(true);
|
emit done(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output);
|
voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output);
|
||||||
|
// ids2 and output are closed by voicefont().
|
||||||
|
|
||||||
//cleanup
|
//cleanup
|
||||||
cleanup();
|
cleanup();
|
||||||
|
@ -216,7 +219,8 @@ void VoiceFileCreator::downloadDone(bool error)
|
||||||
// Add Voice file to the install log
|
// Add Voice file to the install log
|
||||||
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
|
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
|
||||||
installlog.beginGroup("selfcreated Voice");
|
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.endGroup();
|
||||||
installlog.sync();
|
installlog.sync();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue