LightGlue-OnnxRunner icon indicating copy to clipboard operation
LightGlue-OnnxRunner copied to clipboard

double free in LightGlueOnnxRunner.cpp

Open rebmaso opened this issue 1 year ago • 1 comments

[in LightGlueOnnxRunner.cpp]

First, thanks for the repo!

Spotted a delete that I think shouldnt be there. You pass cfg by value, then delete a pointer to cfg.lightgluepath. This causes a double free error as the pass-by-value cfg object is implicitly deleted after function execution. The faulty line is line 63. Just remove delete modelPath.

PS: maybe the same thing is in LightGlueDecoupleOnnxRunner.cpp as well, idk

const size_t numOutputNodes = session->GetOutputCount();
        OutputNodeNames.reserve(numOutputNodes);
        for (size_t i = 0 ; i < numOutputNodes ; i++)
        {
            OutputNodeNames.emplace_back(_strdup(session->GetOutputNameAllocated(i , allocator).get()));
            OutputNodeShapes.emplace_back(session->GetOutputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape());
        }

        delete modelPath;
        
        std::cout << "[INFO] ONNXRuntime environment created successfully." << std::endl;

rebmaso avatar Dec 13 '23 11:12 rebmaso

Thank you for pointing out the bug, we will fix it as soon as possible❤️

OroChippw avatar Jan 08 '24 01:01 OroChippw