nyx: utilize ini free and fix various memleaks

With the new changes the heap and heap node usage drops 95% on boot. Subsequent accesses to Launch/More config keep the counter the same.
This commit is contained in:
CTCaer
2022-05-19 15:14:05 +03:00
parent 8428ce1a2e
commit 38010ce65e
7 changed files with 19 additions and 8 deletions

View File

@@ -1378,14 +1378,10 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
goto out_end;
}
char *dir = (char *)malloc(256);
strcpy(dir, "bootloader/payloads");
char *filelist = dirlist(dir, NULL, false, false);
char *filelist = dirlist("bootloader/payloads", NULL, false, false);
sd_unmount();
u32 i = 0;
if (filelist)
{
while (true)
@@ -1395,6 +1391,7 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
lv_list_add(list, NULL, &filelist[i * 256], launch_payload);
i++;
}
free(filelist);
}
out_end:
@@ -1703,9 +1700,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
if (combined_cfg && !ini_parse_success)
{
ini_parsing:
// Reinit list.
ini_sections.prev = &ini_sections;
ini_sections.next = &ini_sections;
list_init(&ini_sections);
ini_parse_success = ini_parse(&ini_sections, "bootloader/ini", true);
more_cfg = true;
}
@@ -1851,6 +1846,8 @@ ini_parsing:
break;
}
ini_free(&ini_sections);
ini_parse_failed:
// Reiterate the loop with more cfgs if combined.
if (combined_cfg && (curr_btn_idx < (n_cfg.entries_5_columns ? 10 : 8)) && !more_cfg)