Skip to content

Commit a5520f8

Browse files
committed
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
1 parent 9bfa625 commit a5520f8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

supervisor/shared/display.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
8181
void supervisor_stop_terminal(void) {
8282
if (tilegrid_tiles != NULL) {
8383
free_memory(tilegrid_tiles);
84+
tilegrid_tiles = NULL;
8485
supervisor_terminal_text_grid.inline_tiles = false;
8586
supervisor_terminal_text_grid.tiles = NULL;
8687
}

0 commit comments

Comments
 (0)