From: Jean-Baptiste M. <jb...@kd...> - 2012-09-02 09:41:44
|
Git commit 0eec75fae8e6c65857a4ed2abd966c901b05bfab by Jean-Baptiste Mardelle, on behalf of Mikko Rapeli. Committed on 10/08/2012 at 14:17. Pushed by mardelle into branch 'master'. titledocument.cpp: check return value from open() 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()); M +2 -1 src/titledocument.cpp http://commits.kde.org/kdenlive/0eec75fae8e6c65857a4ed2abd966c901b05bfab 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(); |