Index: checkboxtree.c =================================================================== RCS file: /usr/local/CVS/newt/checkboxtree.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- checkboxtree.c 12 Apr 2007 16:57:33 -0000 1.33 +++ checkboxtree.c 12 Apr 2007 17:03:57 -0000 1.34 @@ -531,19 +531,26 @@ (*ct->currItem ? (*ct->currItem)->depth : 0) * 3 + 4); } -static void ctDestroy(newtComponent co) { - struct CheckboxTree * ct = co->data; - struct items * item, * nextitem; - - nextitem = item = ct->itemlist; +static void destroyItems(struct items * item) { + struct items * nextitem; while (item != NULL) { nextitem = item->next; free(item->text); + if (item->branch) + destroyItems(item->branch); free(item); item = nextitem; } +} + +static void ctDestroy(newtComponent co) { + struct CheckboxTree * ct = co->data; + destroyItems(ct->itemlist); + free(ct->flatList); + if (ct->sb) + ct->sb->ops->destroy(ct->sb); free(ct->seq); free(ct); free(co); @@ -802,6 +809,7 @@ treeTop = item->branch; } + free(path); buildFlatList(co); item = findItem(ct->itemlist, data); Index: textbox.c =================================================================== RCS file: /usr/local/CVS/newt/textbox.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- textbox.c 12 Oct 2006 14:18:38 -0000 1.38 +++ textbox.c 12 Apr 2007 17:03:57 -0000 1.39 @@ -451,6 +451,10 @@ int i; struct textbox * tb = co->data; + if (tb->sb) + tb->sb->ops->destroy(tb->sb); + if (tb->sb_act) + tb->sb_act->ops->destroy(tb->sb_act); for (i = 0; i < tb->numLines; i++) free(tb->lines[i]); free(tb->lines);