[Kdenlive-devel] [PATCH 13/16] projectsettings.cpp: return if open() fails

Mikko Rapeli mikko.rapeli at iki.fi
Fri Aug 10 12:17:14 UTC 2012


Fixes Coverity CID 709281: 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))".
552    xmlf.open(QIODevice::WriteOnly);
---
 src/projectsettings.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp
index ba8aebf..9289e18 100644
--- a/src/projectsettings.cpp
+++ b/src/projectsettings.cpp
@@ -549,7 +549,8 @@ void ProjectSettings::slotExportToText()
         return;
     }
     QFile xmlf(tmpfile.fileName());
-    xmlf.open(QIODevice::WriteOnly);
+    if (!xmlf.open(QIODevice::WriteOnly))
+        return;
     xmlf.write(data.toUtf8());
     if (xmlf.error() != QFile::NoError) {
         xmlf.close();
-- 
1.7.10.4





More information about the Kdenlive mailing list