summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/voicefile.cpp
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/rbutilqt/base/voicefile.cpp
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/rbutilqt/base/voicefile.cpp')
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp8
1 files changed, 6 insertions, 2 deletions
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();