Set the terminal tilegrid NULL after free
Without this, a double free can occur when a display (and terminal) is released and then a crash occurs. Upon a second release, different memory is released (sometimes the heap). When this is followed by an allocation for the flash cache, the cache can overwrite the active heap causing crashes. Fixes #1667
This commit is contained in:
parent
9bfa625170
commit
a5520f8a3d
@ -81,6 +81,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
|
|||||||
void supervisor_stop_terminal(void) {
|
void supervisor_stop_terminal(void) {
|
||||||
if (tilegrid_tiles != NULL) {
|
if (tilegrid_tiles != NULL) {
|
||||||
free_memory(tilegrid_tiles);
|
free_memory(tilegrid_tiles);
|
||||||
|
tilegrid_tiles = NULL;
|
||||||
supervisor_terminal_text_grid.inline_tiles = false;
|
supervisor_terminal_text_grid.inline_tiles = false;
|
||||||
supervisor_terminal_text_grid.tiles = NULL;
|
supervisor_terminal_text_grid.tiles = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user