Skip to content

Commit

Permalink
fix: free memory on sd card info menu
Browse files Browse the repository at this point in the history
  • Loading branch information
DeimosHall committed Oct 4, 2024
1 parent cce6abd commit 6796513
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions firmware/main/modules/settings/settings_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@ void update_sd_card_info() {
char* type_str = malloc(strlen(sd_info.type) + 1 + 6);
sprintf(type_str, "Type: %s", sd_info.type);

sd_card_info_2[0] = "";
sd_card_info_2[1] = "SD Card Info";
sd_card_info_2[2] = name_str;
sd_card_info_2[3] = capacity_str;
sd_card_info_2[4] = speed_str;
sd_card_info_2[5] = type_str;
sd_card_info_2[0] = strdup("");
sd_card_info_2[1] = strdup("SD Card Info");
sd_card_info_2[2] = strdup(name_str);
sd_card_info_2[3] = strdup(capacity_str);
sd_card_info_2[4] = strdup(speed_str);
sd_card_info_2[5] = strdup(type_str);

free(name_str);
free(capacity_str);
free(speed_str);
free(type_str);
}

sd_card_unmount();
Expand Down

0 comments on commit 6796513

Please sign in to comment.