/* free dash and its elements */ void free_dashboard (GDash * dash) { int i, j; for (i = 0; i < TOTAL_MODULES; i++) { for (j = 0; j < dash->module[i].alloc_data; j++) { free_dashboard_data (dash->module[i].data[j]); } free (dash->module[i].data); } free (dash); }
/* Free memory allocated for a GDash instance, and nested structure * data. */ void free_dashboard (GDash * dash) { GModule module; int j; size_t idx = 0; FOREACH_MODULE (idx, module_list) { module = module_list[idx]; for (j = 0; j < dash->module[module].alloc_data; j++) { free_dashboard_data (dash->module[module].data[j]); } free (dash->module[module].data); }