// free memory for various things at the end of the program func cleanup(menu_items []*gc.MenuItem, contactMenu *gc.Menu) { for i := 0; i < len(menu_items); i++ { menu_items[i].Free() } contactMenu.UnPost() contactMenu.Free() }
func freeMenu(menu *goncurses.Menu) { if menu != nil { menu.UnPost() for _, item := range menu.Items() { item.Free() } menu.Free() } }