[Digikam-devel] New Defects reported by Coverity Scan for digiKam

scan-admin at coverity.com scan-admin at coverity.com
Thu Apr 18 13:37:26 BST 2013


Hi,

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

Defect(s) Reported-by: Coverity Scan

	
** CID 1004807: Uninitialized pointer field (UNINIT_CTOR)
/mnt/devel/GIT/3.x/extra/libkface/libkface/facerecognizer.cpp: 55
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=1004807

** CID 1004806: Non-array delete for scalars (DELETE_ARRAY)
/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 262
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=1004806

** CID 1004805: Non-array delete for scalars (DELETE_ARRAY)
/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 124
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=1004805

** CID 1002052: Resource leak (RESOURCE_LEAK)
/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 884
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=1002052

** CID 1002051: Resource leak (RESOURCE_LEAK)
/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 567
http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10358#mergedDefectId=1002051


________________________________________________________________________
CID 1004807: Uninitialized pointer field (UNINIT_CTOR)

/mnt/devel/GIT/3.x/extra/libkface/libkface/facerecognizer.cpp: 83 ( member_decl)
   80    public:
   81    
   82        float threshold;
>>> Class member declaration for "facemodeltostore".
   83        unitFaceModel *facemodeltostore;
   84    
   85    private:
   86    
   87        Tldrecognition*  tldRecognitionCore;
  

/mnt/devel/GIT/3.x/extra/libkface/libkface/facerecognizer.cpp: 55 ( uninit_member)
   52            threshold          = 0.3;
   53            tldRecognitionCore = 0;
   54            db                 = 0;
>>> CID 1004807: Uninitialized pointer field (UNINIT_CTOR)
>>> Non-static class member "facemodeltostore" is not initialized in this constructor nor in any functions that it calls.
   55        }
   56    
   57        ~Private()
   58        {
   59            delete db;
  
________________________________________________________________________
CID 1004806: Non-array delete for scalars (DELETE_ARRAY)

/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 143 ( new_array)
   140        int numDistances = numConfidentIndices * (numConfidentIndices - 1) / 2;
   141    
   142        //Now: Cluster distances
>>> Using new in : "new int[numDistances]".
   143        int *distUsed = new int[numDistances];
   144    
   145        for(int i = 0; i < numDistances; i++)
   146        {
   147            distUsed[i] = 0;
  

/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 143 ( var_assign)
   140        int numDistances = numConfidentIndices * (numConfidentIndices - 1) / 2;
   141    
   142        //Now: Cluster distances
>>> Assigning: "distUsed" = storage from "new int[numDistances]".
   143        int *distUsed = new int[numDistances];
   144    
   145        for(int i = 0; i < numDistances; i++)
   146        {
   147            distUsed[i] = 0;
  

/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 262 ( delete_var)
   259                }
   260            }
   261        }
>>> CID 1004806: Non-array delete for scalars (DELETE_ARRAY)
>>> Deleting array variable "distUsed" with non-array delete in "delete distUsed".
   262        delete distUsed;
   263    
   264        detectionResult->numClusters = numClusters;
   265    }
   266    
  
________________________________________________________________________
CID 1004805: Non-array delete for scalars (DELETE_ARRAY)

/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 113 ( new_array)
   110    void Clustering::clusterConfidentIndices()
   111    {
   112        int numConfidentIndices = detectionResult->confidentIndices->size();
>>> Using new in : "new float[numConfidentIndices * (numConfidentIndices - 1) / 2]".
   113        float *distances = new float[numConfidentIndices * (numConfidentIndices - 1) / 2];
   114        calcDistances(distances);
   115        int *clusterIndices = new int[numConfidentIndices];
   116        cluster(distances, clusterIndices);
   117    
  

/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 113 ( var_assign)
   110    void Clustering::clusterConfidentIndices()
   111    {
   112        int numConfidentIndices = detectionResult->confidentIndices->size();
>>> Assigning: "distances" = storage from "new float[numConfidentIndices * (numConfidentIndices - 1) / 2]".
   113        float *distances = new float[numConfidentIndices * (numConfidentIndices - 1) / 2];
   114        calcDistances(distances);
   115        int *clusterIndices = new int[numConfidentIndices];
   116        cluster(distances, clusterIndices);
   117    
  

/mnt/devel/GIT/3.x/extra/libkface/OpenTLD/src/libopentld/tld/Clustering.cpp: 124 ( delete_var)
   121            //TODO: Take the maximum confidence as the result confidence.
   122        }
   123    
>>> CID 1004805: Non-array delete for scalars (DELETE_ARRAY)
>>> Deleting array variable "distances" with non-array delete in "delete distances".
   124        delete distances;
   125        delete clusterIndices;
   126    
   127    }
   128    
  
________________________________________________________________________
CID 1002052: Resource leak (RESOURCE_LEAK)

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 875 ( alloc_fn)
   872                iface.fillImageInFaces(package->image, package->faces, size);
   873            }
   874    
>>> Storage is returned from allocation function "operator new(std::size_t)".
   875            KFaceIface::FaceRecognizer * const recogniser = new KFaceIface::FaceRecognizer();
   876            
   877            for(int faceindex = 0;faceindex < package->faces.size();faceindex++)
   878            {
   879                package->faces[faceindex].setId(package->databaseFaces[faceindex].assignedTagId);
  

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 875 ( var_assign)
   872                iface.fillImageInFaces(package->image, package->faces, size);
   873            }
   874    
>>> Assigning: "recogniser" = storage returned from "new KFaceIface::FaceRecognizer".
   875            KFaceIface::FaceRecognizer * const recogniser = new KFaceIface::FaceRecognizer();
   876            
   877            for(int faceindex = 0;faceindex < package->faces.size();faceindex++)
   878            {
   879                package->faces[faceindex].setId(package->databaseFaces[faceindex].assignedTagId);
  

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 883 ( noescape)
   880                kDebug() << "person  " << qPrintable(package->faces.at(faceindex).name())
   881                         << "  stored in recognition database" ;
   882            }
>>> Resource "recogniser" is not freed or pointed-to in function "KFaceIface::FaceRecognizer::storeFaces(QList<KFaceIface::Face> const &)".
   883            recogniser->storeFaces(package->faces);
   884        }
   885    
   886        iface.removeFaces(toTrain);
   887        package->databaseFaces.replaceRole(FacePipelineDatabaseFace::ForTraining, FacePipelineDatabaseFace::Trained);
  

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 884 ( leaked_storage)
   881                         << "  stored in recognition database" ;
   882            }
   883            recogniser->storeFaces(package->faces);
>>> CID 1002052: Resource leak (RESOURCE_LEAK)
>>> Variable "recogniser" going out of scope leaks the storage it points to.
   884        }
   885    
   886        iface.removeFaces(toTrain);
   887        package->databaseFaces.replaceRole(FacePipelineDatabaseFace::ForTraining, FacePipelineDatabaseFace::Trained);
   888    
  
________________________________________________________________________
CID 1002051: Resource leak (RESOURCE_LEAK)

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 547 ( alloc_fn)
   544            iface.fillImageInFaces(package->image, package->faces, size);
   545        }
   546    
>>> Storage is returned from allocation function "operator new(std::size_t)".
   547        KFaceIface::FaceRecognizer *recogniser = new KFaceIface::FaceRecognizer();
   548    
   549        QList<float> recgnitionRate =  recogniser->recognizeFaces(package->faces);
   550        
   551        if(!recgnitionRate.empty())
  

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 547 ( var_assign)
   544            iface.fillImageInFaces(package->image, package->faces, size);
   545        }
   546    
>>> Assigning: "recogniser" = storage returned from "new KFaceIface::FaceRecognizer".
   547        KFaceIface::FaceRecognizer *recogniser = new KFaceIface::FaceRecognizer();
   548    
   549        QList<float> recgnitionRate =  recogniser->recognizeFaces(package->faces);
   550        
   551        if(!recgnitionRate.empty())
  

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 549 ( noescape)
   546    
   547        KFaceIface::FaceRecognizer *recogniser = new KFaceIface::FaceRecognizer();
   548    
>>> Resource "recogniser" is not freed or pointed-to in function "KFaceIface::FaceRecognizer::recognizeFaces(QList<KFaceIface::Face> &)".
   549        QList<float> recgnitionRate =  recogniser->recognizeFaces(package->faces);
   550        
   551        if(!recgnitionRate.empty())
   552        {
   553            for(int faceindex = 0;faceindex < package->faces.size() ;faceindex++ )
  

/mnt/devel/GIT/3.x/core/utilities/facemanagement/facepipeline.cpp: 567 ( leaked_storage)
   564    
   565        package->processFlags |= FacePipelinePackage::ProcessedByRecognizer;
   566        emit processed(package);
>>> CID 1002051: Resource leak (RESOURCE_LEAK)
>>> Variable "recogniser" going out of scope leaks the storage it points to.
   567    }
   568    
   569    void RecognitionWorker::setThreshold(double threshold)
   570    {
   571        recognitionThreshold = (float) threshold;
  
________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan5.coverity.com:8080

If you don't have a username, you can request one by emailing: scan-admin at coverity.com

To unsubscribe from the email notification for new defects, http://scan.coverity.com/email_unsubscribe.html
If you are project owner, you can subscribe your team member by accessing  http://scan.coverity.com/email_subscription.html



More information about the Digikam-devel mailing list