xflouris / libpll

Phylogenetic Likelihood Library
GNU Affero General Public License v3.0
26 stars 6 forks source link

deallocate memory in case of erroneous tree parsing #123

Closed xflouris closed 7 years ago

xflouris commented 7 years ago

When parsing an incomplete tree, e.g. (A,B),C a memory leak is caused because the two independent subtrees (A,B) and C are allocated (and parsed), but since there is no pointer to a single connected tree graph, they are never de-allocated.

One solution is to implement a simple garbage collector, which stores the addresses to all allocated memory segments, and de-allocates them in the case of error in parsing.

xflouris commented 7 years ago

fixed using destructors