[Kdenlive-devel] [PATCH 15/16] titledocument.cpp: check return value from open()
Mikko Rapeli
mikko.rapeli at iki.fi
Fri Aug 10 12:17:16 UTC 2012
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/titledocument.cpp b/src/titledocument.cpp
index 95aff61..6ab7d19 100644
--- a/src/titledocument.cpp
+++ b/src/titledocument.cpp
@@ -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();
--
1.7.10.4
More information about the Kdenlive
mailing list