Example #1
0
void freeAST(node * ast)
{
        // Probably should recursively free the nodes you created.
         if (ast == NULL) return;
          freeAST(ast->child1);
          freeAST(ast->child2);
          freeAST(ast->child3);
          free(ast);
}
NestedAllpassNetwork::~NestedAllpassNetwork() {
	freeAST(start);
	freeAST(next_start);
}
//Small recursive helper function for freeing.
static void freeAST(NestedAllpassNetworkASTNode* start) {
	if(start == nullptr) return;
	NestedAllpassNetworkASTNode *next = start->next, *nested = start->nested;
	freeAST(next);
	freeAST(nested);
}