[Digikam-devel] New Defects reported by Coverity Scan for digiKam
scan-admin at coverity.com
scan-admin at coverity.com
Sun Mar 13 02:19:31 GMT 2016
Hi,
Please find the latest report on new defect(s) introduced to digiKam found with Coverity Scan.
9 new defect(s) introduced to digiKam found with Coverity Scan.
6 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 9 of 9 defect(s)
** CID 1355582: Control flow issues (DEADCODE)
/home/gilles/Devel/5.x/core/utilities/presentation/opengl/presentationkb.cpp: 94 in Digikam::KBViewTrans::KBViewTrans(bool, float)()
________________________________________________________________________________________________________
*** CID 1355582: Control flow issues (DEADCODE)
/home/gilles/Devel/5.x/core/utilities/presentation/opengl/presentationkb.cpp: 94 in Digikam::KBViewTrans::KBViewTrans(bool, float)()
88 {
89 s[0] = 0.3 * rnd() + 1.0;
90 s[1] = 0.3 * rnd() + 1.0;
91 }
92 while ((fabs(s[0] - s[1]) < 0.15) && (++i < 10));
93
>>> CID 1355582: Control flow issues (DEADCODE)
>>> Execution cannot reach the expression "s[0] > s[1]" inside this statement: "if (!zoomIn || s[0] > s[1] ...".
94 if ((!zoomIn || (s[0] > s[1])) ||
95 ( zoomIn || !(s[0] > s[1])))
96 {
97 double tmp = s[0];
98 s[0] = s[1];
99 s[1] = tmp;
** CID 1324461: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/sendimages/sendimages.cpp: 302 in KIPISendimagesPlugin::SendImages::buildPropertiesFile()()
________________________________________________________________________________________________________
*** CID 1324461: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/sendimages/sendimages.cpp: 302 in KIPISendimagesPlugin::SendImages::buildPropertiesFile()()
296 }
297
298 QFile propertiesFile( d->settings.tempPath + i18n("properties.txt") );
299 QTextStream stream( &propertiesFile );
300 stream.setCodec(QTextCodec::codecForName("UTF-8"));
301 stream.setAutoDetectUnicode(true);
>>> CID 1324461: Error handling issues (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
302 propertiesFile.open(QIODevice::WriteOnly);
303 stream << propertiesText << QLatin1String("\n");
304 propertiesFile.close();
305 d->attachementFiles << QUrl(propertiesFile.fileName());
306
307 d->progressDlg->progressWidget()->addedAction(i18n("Image properties file done"), SuccessMessage);
** CID 1324460: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/mediawiki/wikimediajob.cpp: 145 in KIPIWikiMediaPlugin::WikiMediaJob::uploadHandle(KJob *)()
________________________________________________________________________________________________________
*** CID 1324460: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/mediawiki/wikimediajob.cpp: 145 in KIPIWikiMediaPlugin::WikiMediaJob::uploadHandle(KJob *)()
139 QMap<QString,QString> info = d->imageDesc.take(keys.first());
140 Upload* const e1 = new Upload(*d->mediawiki, this);
141
142 qCDebug(KIPIPLUGINS_LOG) << "Path:" << keys.first();
143
144 QFile* const file = new QFile(keys.first(),this);
>>> CID 1324460: Error handling issues (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
145 file->open(QIODevice::ReadOnly);
146 //emit fileUploadProgress(done = 0, total file.size());
147
148 e1->setFile(file);
149 d->currentFile = file->fileName();
150 qCDebug(KIPIPLUGINS_LOG) << "Name:" << file->fileName();
** CID 1324459: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/kmlexport/kmlexport.cpp: 525 in KIPIKMLExportPlugin::KmlExport::generate()()
________________________________________________________________________________________________________
*** CID 1324459: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/kmlexport/kmlexport.cpp: 525 in KIPIKMLExportPlugin::KmlExport::generate()()
519 "No position data for %1 pictures", defectImage));
520 }
521
522 /** @todo change to kml or kmz if compressed */
523 QFile file(m_tempDestDir.filePath(m_KMLFileName + QLatin1String(".kml")));
524 /** @todo handle file opening problems */
>>> CID 1324459: Error handling issues (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
525 file.open( QIODevice::WriteOnly );
526 QTextStream stream( &file ); // we will serialize the data into the file
527 stream << m_kmlDocument->toString();
528 file.close();
529
530 delete m_kmlDocument;
** CID 1324458: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/kmlexport/kmlexport.cpp: 201 in KIPIKMLExportPlugin::KmlExport::generateImagesthumb(const QUrl &, QDomElement &)()
________________________________________________________________________________________________________
*** CID 1324458: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/kmlexport/kmlexport.cpp: 201 in KIPIKMLExportPlugin::KmlExport::generateImagesthumb(const QUrl &, QDomElement &)()
195 {
196 logWarning(i18n("Format of image '%1' is unknown",path));
197 return;
198 }
199
200 imageFile.close();
>>> CID 1324458: Error handling issues (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
201 imageFile.open(QIODevice::ReadOnly);
202
203 QByteArray imageData = imageFile.readAll();
204 QImage image;
205
206 if (!image.loadFromData(imageData) )
** CID 1324457: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 406 in KIPIFlashExportPlugin::SimpleViewer::exportImages()()
________________________________________________________________________________________________________
*** CID 1324457: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 406 in KIPIFlashExportPlugin::SimpleViewer::exportImages()()
400 if (d->canceled)
401 return false;
402
403 d->progressWdg->addedAction(i18n("Creating images and thumbnails..."), StartingMessage);
404
405 QFile file(d->tempDir->path() + QLatin1String("/gallery.xml"));
>>> CID 1324457: Error handling issues (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
406 file.open(QIODevice::WriteOnly);
407
408 // header of gallery.xml
409 QDomElement galleryElem;
410 QDomElement photosElem;
411 QDomDocument xmlDoc;
** CID 1324454: (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 840 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 852 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 871 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 883 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 902 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 940 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 958 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 968 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
________________________________________________________________________________________________________
*** CID 1324454: (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 840 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
834 //TODO: errormsg
835 qCDebug(KIPIPLUGINS_LOG) << "No indexTemplateName" ;
836 return false;
837 }
838
839 QFile infile(indexTemplateName);
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
840 infile.open(QIODevice::ReadOnly);
841 QTextStream in(&infile);
842 QString indexTemplate = in.readAll();
843 infile.close();
844
845 indexTemplate.replace(QLatin1String("{TITLE}"), d->settings->title);
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 852 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
846 indexTemplate.replace(QLatin1String("{COLOR}"), d->settings->textColor.name());
847 indexTemplate.replace(QLatin1String("{BGCOLOR}"), d->settings->backgroundColor.name());
848 indexTemplate.replace(QLatin1String("{HOSTURL}"), d->hostUrl);
849 indexTemplate.replace(QLatin1String("{HOSTNAME}"), d->hostName);
850
851 QFile outfile(d->tempDir->path() + QLatin1String("/index.html"));
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
852 outfile.open(QIODevice::WriteOnly);
853 QTextStream out(&outfile);
854 out << indexTemplate;
855 outfile.close();
856 break;
857 }
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 871 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
865 //TODO: errormsg
866 qCDebug(KIPIPLUGINS_LOG) << "No indexTemplateName" ;
867 return false;
868 }
869
870 QFile infile(indexTemplateName);
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
871 infile.open(QIODevice::ReadOnly);
872 QTextStream in(&infile);
873 QString indexTemplate = in.readAll();
874 infile.close();
875
876 indexTemplate.replace(QLatin1String("{TITLE}"), d->settings->title);
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 883 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
877 indexTemplate.replace(QLatin1String("{COLOR}"), d->settings->textColor.name());
878 indexTemplate.replace(QLatin1String("{BGCOLOR}"), d->settings->backgroundColor.name());
879 //indexTemplate.replace("{HOSTNAME}", d->hostName);
880 //indexTemplate.replace("{HOSTURL}", d->hostUrl);
881
882 QFile outfile(d->tempDir->path() + QLatin1String("/index.html"));
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
883 outfile.open(QIODevice::WriteOnly);
884 QTextStream out(&outfile);
885 out << indexTemplate;
886 outfile.close();
887 break;
888 }
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 902 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
896 //TODO: errormsg
897 qCDebug(KIPIPLUGINS_LOG) << "No indexTemplateName" ;
898 return false;
899 }
900
901 QFile infile(indexTemplateName);
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
902 infile.open(QIODevice::ReadOnly);
903 QTextStream in(&infile);
904 QString indexTemplate = in.readAll();
905 infile.close();
906
907 indexTemplate.replace(QLatin1String("{TITLE}"), d->settings->title);
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 940 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
934 QLatin1Char('#'), QLatin1String("0x")));
935 indexTemplate.replace(QLatin1String("{BACKOUTCOLOR}"),
936 d->settings->bkgndOuterColor.name().replace(
937 QLatin1Char('#'), QLatin1String("0x")));
938
939 QFile outfile(d->tempDir->path() + QLatin1String("/index.html"));
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
940 outfile.open(QIODevice::WriteOnly);
941 QTextStream out(&outfile);
942 out << indexTemplate;
943 outfile.close();
944 break;
945 }
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 958 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
952 //TODO: errormsg
953 qCDebug(KIPIPLUGINS_LOG) << "No indexTemplateName" ;
954 return false;
955 }
956
957 QFile infile(indexTemplateName);
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
958 infile.open(QIODevice::ReadOnly);
959 QTextStream in(&infile);
960 QString indexTemplate = in.readAll();
961 infile.close();
962
963 indexTemplate.replace(QLatin1String("{TITLE}"), d->settings->title);
/home/gilles/Devel/5.x/extra/kipi-plugins/flashexport/simpleviewer.cpp: 968 in KIPIFlashExportPlugin::SimpleViewer::createIndex() const()
962
963 indexTemplate.replace(QLatin1String("{TITLE}"), d->settings->title);
964 indexTemplate.replace(QLatin1String("{COLOR}"), d->settings->textColor.name());
965 indexTemplate.replace(QLatin1String("{BGCOLOR}"), d->settings->backgroundColor.name());
966
967 QFile outfile(d->tempDir->path() + QLatin1String("/index.html"));
>>> CID 1324454: (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
968 outfile.open(QIODevice::WriteOnly);
969 QTextStream out(&outfile);
970 out << indexTemplate;
971 outfile.close();
972 break;
973 }
** CID 1324453: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/piwigo/piwigotalker.cpp: 104 in KIPIPiwigoExportPlugin::PiwigoTalker::computeMD5Sum(const QString &)()
________________________________________________________________________________________________________
*** CID 1324453: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/piwigo/piwigotalker.cpp: 104 in KIPIPiwigoExportPlugin::PiwigoTalker::computeMD5Sum(const QString &)()
98 }
99
100 QByteArray PiwigoTalker::computeMD5Sum(const QString& filepath)
101 {
102 QFile file(filepath);
103
>>> CID 1324453: Error handling issues (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
104 file.open(QIODevice::ReadOnly);
105 QByteArray md5sum = QCryptographicHash::hash(file.readAll(), QCryptographicHash::Md5);
106 file.close();
107
108 return md5sum;
109 }
** CID 1324452: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/piwigo/piwigotalker.cpp: 829 in KIPIPiwigoExportPlugin::PiwigoTalker::addNextChunk()()
________________________________________________________________________________________________________
*** CID 1324452: Error handling issues (CHECKED_RETURN)
/home/gilles/Devel/5.x/extra/kipi-plugins/piwigo/piwigotalker.cpp: 829 in KIPIPiwigoExportPlugin::PiwigoTalker::addNextChunk()()
823 void PiwigoTalker::addNextChunk()
824 {
825 m_job = 0;
826
827 QFile imagefile(m_path);
828
>>> CID 1324452: Error handling issues (CHECKED_RETURN)
>>> Calling "open" without checking return value (as is done elsewhere 83 out of 99 times).
829 imagefile.open(QIODevice::ReadOnly);
830
831 m_chunkId++; // We start with chunk 1
832
833 imagefile.seek((m_chunkId - 1) * CHUNK_MAX_SIZE);
834
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/digikam?tab=overview
To manage Coverity Scan email notifications for "digikam-devel at kde.org", click https://scan.coverity.com/subscriptions/edit?email=digikam-devel%40kde.org&token=621bfe7450f4a870432a2a9c106aa3a8
More information about the Digikam-devel
mailing list