summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-04-01 22:06:52 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-04-01 22:06:52 +0000
commitd6543b71afcceb028953b0fffcf5ed8f2942182e (patch)
tree459f317465700d4681183248c1b4f5fa3f036065 /rbutil
parent0d6828e064eee6c4bdac1dd9e9ce9bf522f9754a (diff)
downloadrockbox-d6543b71afcceb028953b0fffcf5ed8f2942182e.tar.gz
rockbox-d6543b71afcceb028953b0fffcf5ed8f2942182e.tar.bz2
rockbox-d6543b71afcceb028953b0fffcf5ed8f2942182e.zip
Fix leaking file descriptors on error.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25431 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/base/encoders.cpp2
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/rbutil/rbutilqt/base/encoders.cpp b/rbutil/rbutilqt/base/encoders.cpp
index 795b622bbd..7f4163a34f 100644
--- a/rbutil/rbutilqt/base/encoders.cpp
+++ b/rbutil/rbutilqt/base/encoders.cpp
@@ -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);
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index 2ccdd05c09..ccdf6f7f9a 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -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();