Potential memory leak
Opened this issue · 0 comments
Hi @zarquon42b
I was testing my code with valgrind
and it led me to the following code:
Lines 96 to 99 in a7c34a5
I wonder should AddPerVertexAttribute
be used with DeletePerVertexAttribute
together?
https://vcg.isti.cnr.it/vcglib/attributes.html states that:
Remember that the scope of a handle does not interfere with the memory allocation of the attribute. If you do not delete an attribute explicitly, it will stay allocated until the mesh itself is destroyed, even if you do not have any more handles to it.
Also the following code may segfault when the path does not exist (not connected)
Lines 117 to 121 in a7c34a5
When the segfault happens, parent
will be NULL
, hence indexing indices[parent]
will crash the process.