diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-04-03 15:24:15 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-04-03 15:24:15 -0700 |
| commit | a5520f8a3d7d866d4e97de8f04a08ab3dd908470 (patch) | |
| tree | bf53489599466c0a4be3028516881d86e7aaeddf /supervisor | |
| parent | 9bfa6251709557e3eb11ceb4d3455b0a2f03ac80 (diff) | |
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
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/display.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index e1400426e..acf8e69d4 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -81,6 +81,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { void supervisor_stop_terminal(void) { if (tilegrid_tiles != NULL) { free_memory(tilegrid_tiles); + tilegrid_tiles = NULL; supervisor_terminal_text_grid.inline_tiles = false; supervisor_terminal_text_grid.tiles = NULL; } |
