I've discovered a memory leak in the 3DS plugin.
Seems occur only for some 3DS files.
The leak reported is for an allocation in:
file: viewport.cpp
function: lib3ds_viewport_read
line: viewport->layout.viewL=(Lib3dsView*)realloc(viewport->layout.viewL, 
sizeof(Lib3dsView)*views);

It seems that the Lib3dsFile object may contain two viewport objects, but the 
'lib3ds_file_free' function only releases one of them.
My submission adds the line:
lib3ds_viewport_set_views(&file->viewport_keyf,0);
after the line:
lib3ds_viewport_set_views(&file->viewport,0);
which seems to plug the leak I see when loading a file that causes creation of 
the 'viewport_keyf' object.

I have attached the modification to file.cpp relative to revision [10850]
I have also attached a modification to viewport.cpp which adds the ommited 
malloc debug section that I needed track down the source of the leak.

Chris Denham.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30193#30193




Attachments: 
http://forum.openscenegraph.org//files/gsk0013ds_693.zip
http://forum.openscenegraph.org//files/viewport_585.cpp
http://forum.openscenegraph.org//files/file_150.cpp


_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to