]> git.sesse.net Git - kdenlive/commitdiff
titledocument.cpp: check return value from open()
authorMikko Rapeli <mikko.rapeli@iki.fi>
Fri, 10 Aug 2012 12:17:16 +0000 (14:17 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 2 Sep 2012 09:40:50 +0000 (11:40 +0200)
Fixes Coverity CID 709282: Unchecked return value (CHECKED_RETURN)
Calling function "QFile::open(QFlags<QIODevice::OpenModeFlag>)" without checking return value (as is done elsewhere 45 out of 47 times).
No check of the return value of "xmlf.open(QIODevice::OpenMode(_ZN9QIODevice9WriteOnlyE))".
300    xmlf.open(QIODevice::WriteOnly);
301    xmlf.write(doc.toString().toUtf8());

src/titledocument.cpp

index 95aff61225664e430636725b8b86ae2c1842f8e9..6ab7d19e9cf89ff83b494f868a30b40cf1ab1f10 100644 (file)
@@ -297,7 +297,8 @@ bool TitleDocument::saveDocument(const KUrl& url, QGraphicsRectItem* startv, QGr
         return false;
     }
     QFile xmlf(tmpfile.fileName());
-    xmlf.open(QIODevice::WriteOnly);
+    if (!xmlf.open(QIODevice::WriteOnly))
+        return false;
     xmlf.write(doc.toString().toUtf8());
     if (xmlf.error() != QFile::NoError) {
         xmlf.close();