New Defects reported by Coverity Scan for digiKam

scan-admin at coverity.com scan-admin at coverity.com
Thu May 11 17:08:27 BST 2023


Hi,

Please find the latest report on new defect(s) introduced to digiKam found with Coverity Scan.

16 new defect(s) introduced to digiKam found with Coverity Scan.
26 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 16 of 16 defect(s)


** CID 1529990:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 387 in DigikamGenericINatPlugin::INatTalker::restoreApiToken(const QString &, QList<QNetworkCookie> &, bool)()


________________________________________________________________________________________________________
*** CID 1529990:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 387 in DigikamGenericINatPlugin::INatTalker::restoreApiToken(const QString &, QList<QNetworkCookie> &, bool)()
381             for (auto str : cookiesStr.split(QLatin1Char(COOKIE_SEPARATOR)))
382             {
383                 QList<QNetworkCookie> lst(QNetworkCookie::parseCookies(str.toUtf8()));
384     
385                 Q_ASSERT(lst.count() == 1);
386     
>>>     CID 1529990:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type QNetworkCookie.
387                 for (auto cookie : lst)
388                 {
389                     if (INatBrowserDlg::filterCookie(cookie, true, now))
390                     {
391                         cookies << cookie;
392                     }

** CID 1529989:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/sendbymail/manager/imageresizethread.cpp: 35 in DigikamGenericSendByMailPlugin::ImageResizeThread::ImageResizeThread(QObject *)()


________________________________________________________________________________________________________
*** CID 1529989:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/sendbymail/manager/imageresizethread.cpp: 35 in DigikamGenericSendByMailPlugin::ImageResizeThread::ImageResizeThread(QObject *)()
29     {
30     
31     ImageResizeThread::ImageResizeThread(QObject* const parent)
32         : ActionThreadBase(parent)
33     {
34         setObjectName(QLatin1String("ImageResizeThread"));
>>>     CID 1529989:  Resource leaks  (CTOR_DTOR_LEAK)
>>>     Allocating memory by calling "new int".
35         m_count  = new int;
36         *m_count = 0;
37     }
38     
39     ImageResizeThread::~ImageResizeThread()
40     {

** CID 1529988:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inatsuggest.cpp: 399 in DigikamGenericINatPlugin::SuggestTaxonCompletion::slotTaxonAutoCompletions(const QPair<QString, QList<DigikamGenericINatPlugin::Taxon>> &)()


________________________________________________________________________________________________________
*** CID 1529988:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inatsuggest.cpp: 399 in DigikamGenericINatPlugin::SuggestTaxonCompletion::slotTaxonAutoCompletions(const QPair<QString, QList<DigikamGenericINatPlugin::Taxon>> &)()
393         }
394     
395         Completions completions(false);
396     
397         d->completionTaxa.clear();
398     
>>>     CID 1529988:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type Taxon.
399         for (auto taxon : taxa.second)
400         {
401             completions.m_taxa << TaxonAndFlags(taxon);
402             d->completionTaxa.append(taxon);
403         }
404     

** CID 1529987:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 381 in DigikamGenericINatPlugin::INatTalker::restoreApiToken(const QString &, QList<QNetworkCookie> &, bool)()


________________________________________________________________________________________________________
*** CID 1529987:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 381 in DigikamGenericINatPlugin::INatTalker::restoreApiToken(const QString &, QList<QNetworkCookie> &, bool)()
375         QString cookiesStr = d->store->value(d->keyCookies);
376     
377         if (!cookiesStr.isEmpty())
378         {
379             QDateTime now(QDateTime::currentDateTime());
380     
>>>     CID 1529987:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type QString.
381             for (auto str : cookiesStr.split(QLatin1Char(COOKIE_SEPARATOR)))
382             {
383                 QList<QNetworkCookie> lst(QNetworkCookie::parseCookies(str.toUtf8()));
384     
385                 Q_ASSERT(lst.count() == 1);
386     

** CID 1529986:  Low impact quality  (MISSING_MOVE_ASSIGNMENT)
/home/gilles/devel/GIT/8.x/core/libs/imgqsort/imagequalitycontainer.h: 32 in ()


________________________________________________________________________________________________________
*** CID 1529986:  Low impact quality  (MISSING_MOVE_ASSIGNMENT)
/home/gilles/devel/GIT/8.x/core/libs/imgqsort/imagequalitycontainer.h: 32 in ()
26     
27     class KConfigGroup;
28     
29     namespace Digikam
30     {
31     
>>>     CID 1529986:  Low impact quality  (MISSING_MOVE_ASSIGNMENT)
>>>     Class "Digikam::ImageQualityContainer" may benefit from adding a move assignment operator. See other events which show the copy assignment operator being applied to rvalues, where a move assignment may be faster.
32     class DIGIKAM_EXPORT ImageQualityContainer
33     {
34     public:
35     
36         ImageQualityContainer();
37         ImageQualityContainer(const ImageQualityContainer& other);

** CID 1529985:  Low impact quality  (MISSING_MOVE_ASSIGNMENT)
/home/gilles/devel/GIT/8.x/core/libs/widgets/text/localizecontainer.h: 36 in ()


________________________________________________________________________________________________________
*** CID 1529985:  Low impact quality  (MISSING_MOVE_ASSIGNMENT)
/home/gilles/devel/GIT/8.x/core/libs/widgets/text/localizecontainer.h: 36 in ()
30     namespace Digikam
31     {
32     
33     /**
34      * The class LocalizeContainer encapsulates all spell-check and localize related settings.
35      */
>>>     CID 1529985:  Low impact quality  (MISSING_MOVE_ASSIGNMENT)
>>>     Class "Digikam::LocalizeContainer" may benefit from adding a move assignment operator. See other events which show the copy assignment operator being applied to rvalues, where a move assignment may be faster.
36     class DIGIKAM_EXPORT LocalizeContainer
37     {
38     public:
39     
40         explicit LocalizeContainer();
41         ~LocalizeContainer();

** CID 1529984:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 1905 in DigikamGenericINatPlugin::INatTalker::slotTimeout()()


________________________________________________________________________________________________________
*** CID 1529984:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 1905 in DigikamGenericINatPlugin::INatTalker::slotTimeout()()
1899             if (request->isTimeout())
1900             {
1901                 timeoutList.append(qMakePair(it.key(), request));
1902             }
1903         }
1904     
>>>     CID 1529984:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type QPair.
1905         for (auto pair : timeoutList)
1906         {
1907             QNetworkReply* const reply            = pair.first;
1908             d->pendingRequests.remove(reply);
1909     
1910             QNetworkReply::NetworkError errorCode = reply->error();

** CID 1529983:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 794 in DigikamGenericINatPlugin::NearbyPlacesRequest::parseResponse(DigikamGenericINatPlugin::INatTalker &, const QByteArray &) const()


________________________________________________________________________________________________________
*** CID 1529983:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 794 in DigikamGenericINatPlugin::NearbyPlacesRequest::parseResponse(DigikamGenericINatPlugin::INatTalker &, const QByteArray &) const()
788             {
789                 static const QString BBOX_AREA    = QLatin1String("bbox_area");
790                 static const QString DISPLAY_NAME = QLatin1String("display_name");
791                 QJsonObject results               = json[RESULTS].toObject();
792                 QList<Place> places;
793     
>>>     CID 1529983:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type QString.
794                 for (auto key : results.keys())
795                 {
796                     for (auto placeValue : results.value(key).toArray())
797                     {
798                         QJsonObject place = placeValue.toObject();
799                         places.push_front(Place(place[DISPLAY_NAME].toString(),

** CID 1529982:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 807 in DigikamGenericINatPlugin::NearbyPlacesRequest::parseResponse(DigikamGenericINatPlugin::INatTalker &, const QByteArray &) const()


________________________________________________________________________________________________________
*** CID 1529982:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 807 in DigikamGenericINatPlugin::NearbyPlacesRequest::parseResponse(DigikamGenericINatPlugin::INatTalker &, const QByteArray &) const()
801                     }
802                 }
803     
804                 std::sort(places.begin(), places.end());
805                 QStringList placesStrList;
806     
>>>     CID 1529982:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type Place.
807                 for (auto place : places)
808                 {
809                     placesStrList << place.m_name;
810                 }
811     
812                 talker.d->cachedNearbyPlaces.insert(m_query, placesStrList);

** CID 1529981:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/metadata/timeadjust/timeadjustthread.cpp: 54 in DigikamGenericTimeAdjustPlugin::TimeAdjustThread::TimeAdjustThread(QObject *, Digikam::DInfoInterface *)()


________________________________________________________________________________________________________
*** CID 1529981:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/metadata/timeadjust/timeadjustthread.cpp: 54 in DigikamGenericTimeAdjustPlugin::TimeAdjustThread::TimeAdjustThread(QObject *, Digikam::DInfoInterface *)()
48         DInfoInterface*     iface;
49     };
50     
51     
52     TimeAdjustThread::TimeAdjustThread(QObject* const parent, DInfoInterface* const iface)
53         : ActionThreadBase(parent),
>>>     CID 1529981:  Resource leaks  (CTOR_DTOR_LEAK)
>>>     Allocating memory by calling "new DigikamGenericTimeAdjustPlugin::TimeAdjustThread::Private".
54           d(new Private)
55     {
56         d->iface = iface;
57     }
58     
59     TimeAdjustThread::~TimeAdjustThread()

** CID 1529980:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 517 in DigikamGenericINatPlugin::UserRequest::parseResponse(DigikamGenericINatPlugin::INatTalker &, const QByteArray &) const()


________________________________________________________________________________________________________
*** CID 1529980:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inattalker.cpp: 517 in DigikamGenericINatPlugin::UserRequest::parseResponse(DigikamGenericINatPlugin::INatTalker &, const QByteArray &) const()
511     
512                 // save cookies
513     
514                 QDateTime now(QDateTime::currentDateTime());
515                 QByteArray saveCookies;
516     
>>>     CID 1529980:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type QNetworkCookie.
517                 for (auto cookie : m_cookies)
518                 {
519                     if (!INatBrowserDlg::filterCookie(cookie, true, now))
520                     {
521                         continue;
522                     }

** CID 1529979:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/dngconverter/dngconverterthread.cpp: 53 in DigikamGenericDNGConverterPlugin::DNGConverterActionThread::DNGConverterActionThread(QObject *)()


________________________________________________________________________________________________________
*** CID 1529979:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/dngconverter/dngconverterthread.cpp: 53 in DigikamGenericDNGConverterPlugin::DNGConverterActionThread::DNGConverterActionThread(QObject *)()
47         bool updateFileDate;
48         int  previewMode;
49     };
50     
51     DNGConverterActionThread::DNGConverterActionThread(QObject* const parent)
52         : ActionThreadBase(parent),
>>>     CID 1529979:  Resource leaks  (CTOR_DTOR_LEAK)
>>>     Allocating memory by calling "new DigikamGenericDNGConverterPlugin::DNGConverterActionThread::Private".
53           d               (new Private)
54     {
55         qRegisterMetaType<DNGConverterActionData>();
56     }
57     
58     DNGConverterActionThread::~DNGConverterActionThread()

** CID 1529978:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/ocrtextconverter/textconverterthread.cpp: 41 in DigikamGenericTextConverterPlugin::TextConverterActionThread::TextConverterActionThread(QObject *)()


________________________________________________________________________________________________________
*** CID 1529978:  Resource leaks  (CTOR_DTOR_LEAK)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/ocrtextconverter/textconverterthread.cpp: 41 in DigikamGenericTextConverterPlugin::TextConverterActionThread::TextConverterActionThread(QObject *)()
35     
36         OcrOptions opt;
37     };
38     
39     TextConverterActionThread::TextConverterActionThread(QObject* const parent)
40         : ActionThreadBase(parent),
>>>     CID 1529978:  Resource leaks  (CTOR_DTOR_LEAK)
>>>     Allocating memory by calling "new DigikamGenericTextConverterPlugin::TextConverterActionThread::Private".
41           d               (new Private)
42     {
43         qRegisterMetaType<TextConverterActionData>();
44     }
45     
46     TextConverterActionThread::~TextConverterActionThread()

** CID 1529977:    (CHECKED_RETURN)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/panorama/tasks/preprocesstask.cpp: 162 in DigikamGenericPanoramaPlugin::PreProcessTask::computePreview(const QUrl &)()
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/panorama/tasks/preprocesstask.cpp: 159 in DigikamGenericPanoramaPlugin::PreProcessTask::computePreview(const QUrl &)()


________________________________________________________________________________________________________
*** CID 1529977:    (CHECKED_RETURN)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/panorama/tasks/preprocesstask.cpp: 162 in DigikamGenericPanoramaPlugin::PreProcessTask::computePreview(const QUrl &)()
156             if (saved)
157             {
158                 QScopedPointer<DMetadata> meta(new DMetadata);
159                 meta->load(inUrl.toLocalFile());
160                 MetaEngine::ImageOrientation orientation = meta->getItemOrientation();
161     
>>>     CID 1529977:    (CHECKED_RETURN)
>>>     Calling "load" without checking return value (as is done elsewhere 17 out of 19 times).
162                 meta->load(outUrl.toLocalFile());
163                 meta->setItemOrientation(orientation);
164                 meta->setItemDimensions(QSize(preview.width(), preview.height()));
165                 meta->applyChanges(true);
166             }
167     
/home/gilles/devel/GIT/8.x/core/dplugins/generic/tools/panorama/tasks/preprocesstask.cpp: 159 in DigikamGenericPanoramaPlugin::PreProcessTask::computePreview(const QUrl &)()
153     
154             // save exif information also to preview image for auto rotation
155     
156             if (saved)
157             {
158                 QScopedPointer<DMetadata> meta(new DMetadata);
>>>     CID 1529977:    (CHECKED_RETURN)
>>>     Calling "load" without checking return value (as is done elsewhere 17 out of 19 times).
159                 meta->load(inUrl.toLocalFile());
160                 MetaEngine::ImageOrientation orientation = meta->getItemOrientation();
161     
162                 meta->load(outUrl.toLocalFile());
163                 meta->setItemOrientation(orientation);
164                 meta->setItemDimensions(QSize(preview.width(), preview.height()));

** CID 1529976:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/tests/database/haariface_utest.cpp: 123 in HaarIfaceTest::initTestCase()()


________________________________________________________________________________________________________
*** CID 1529976:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/tests/database/haariface_utest.cpp: 123 in HaarIfaceTest::initTestCase()()
117     void HaarIfaceTest::initTestCase()
118     {
119         auto dir = QDir(filesPath);
120         startSqlite(dir);
121     
122         // Update collection path, because this is hardcoded
>>>     CID 1529976:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type CollectionLocation.
123         for (const auto col: CollectionManager::instance()->allLocations())
124         {
125             CollectionManager::instance()->removeLocation(col);
126         }
127         QVERIFY(dir.cd(QStringLiteral("Collection")));
128         // The new collection is in the same path as the database, but in the "Collection" subfolder

** CID 1529975:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inatsuggest.cpp: 419 in DigikamGenericINatPlugin::SuggestTaxonCompletion::slotComputerVisionResults(const QPair<QString, QList<DigikamGenericINatPlugin::ComputerVisionScore>> &)()


________________________________________________________________________________________________________
*** CID 1529975:  Performance inefficiencies  (AUTO_CAUSES_COPY)
/home/gilles/devel/GIT/8.x/core/dplugins/generic/webservices/inaturalist/inatsuggest.cpp: 419 in DigikamGenericINatPlugin::SuggestTaxonCompletion::slotComputerVisionResults(const QPair<QString, QList<DigikamGenericINatPlugin::ComputerVisionScore>> &)()
413         }
414     
415         Completions completions(true);
416     
417         d->completionTaxa.clear();
418     
>>>     CID 1529975:  Performance inefficiencies  (AUTO_CAUSES_COPY)
>>>     Using the "auto" keyword without an "&" causes the copy of an object of type ComputerVisionScore.
419         for (auto score : scores.second)
420         {
421             if (score.getTaxon().ancestors().isEmpty())
422             {
423                 Q_ASSERT(!completions.m_commonAncestor.isValid());
424     


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yp2OAl-2Fauo86CB28HCT0-2BnD-2F6eFMYt863B1-2B0FLvU5y-2FRWSl8rMA4vGwCkGPp0f1hg-3DZPy-_IpEMwFcbl-2BY9RHaL2m6a3nuAxB4hfm4MTniX0gHjADWeLgkZtXI-2BySkny3u6pH2ZKBjxCVqUueUyrMrBtHfjUEyT3XXp1a-2F-2FNNmPgEVDd-2FlOFpAzhFyFzI3u-2FE9NmS126szgzEBxy9EjanOG1HoxFnO8z-2FjWuVsD4daIQfqeFZjLf6kysBgCI2Nxx1aNAxgtfbrABSbTNYKx3a9CgRrmFQ-3D-3D



More information about the Digikam-devel mailing list