osg2vsg icon indicating copy to clipboard operation
osg2vsg copied to clipboard

Memory Leak in vsg::ref_ptr<vsg::Data> when using convertToVsg with osg::Image

Open xiaoxin0214 opened this issue 6 months ago • 3 comments

In the function vsg::ref_ptrvsg::Data convertToVsg(const osg::Image* image, bool mapRGBtoRGBAHint), if we simply return nullptr without performing any additional operations, no memory leak occurs:

vsg::ref_ptr<vsg::Data> convertToVsg(const osg::Image* image, bool mapRGBtoRGBAHint)
{
    return nullptr;
}

However, if we execute the conversion logic but still end up returning nullptr, a memory leak occurs.

xiaoxin0214 avatar Jun 13 '25 02:06 xiaoxin0214