static void free_call_tree (tree_entry *e) { unsigned int i; for (i = 0; i < e->nchildren; ++i) { free_call_tree(e->children[i]); free(e->children[i]); } for (i = 0; i < e->norphans; ++i) { free_call_tree(e->orphans[i]); free(e->orphans[i]); } free(e->children); free(e->orphans); }
int free_call_tree (callh *root) { int each; if (root) { for (each = 0; each < root->callers; each++) { free_call_tree (root->caller_list[each]); } if (root->caller_list) free (root->caller_list); free (root); } return 1; }
function_fini () { unsigned int i; for (i = 0; i < nfunctions; ++i) { free(functions[i].name); free(functions[i].file); free(functions[i].callers); free(functions[i].callees); } free(functions); free_call_tree(&call_tree_root); }