From 236d0328c0ad46236a7d72e47940ce6e642b90db Mon Sep 17 00:00:00 2001 From: lixianjing Date: Fri, 10 Jul 2020 06:50:55 -0700 Subject: [PATCH] improve lcd destroy --- src/lcd/lcd_mem.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lcd/lcd_mem.inc b/src/lcd/lcd_mem.inc index 1e20404fc..490fe886a 100644 --- a/src/lcd/lcd_mem.inc +++ b/src/lcd/lcd_mem.inc @@ -308,6 +308,7 @@ static ret_t lcd_mem_end_frame(lcd_t* lcd) { static ret_t lcd_mem_destroy(lcd_t* lcd) { lcd_mem_t* mem = (lcd_mem_t*)lcd; + return_value_if_fail(lcd->begin_frame != NULL, RET_BAD_PARAMS); if (mem->vgcanvas != NULL) { vgcanvas_destroy(mem->vgcanvas); @@ -321,6 +322,7 @@ static ret_t lcd_mem_destroy(lcd_t* lcd) { graphic_buffer_destroy(mem->online_gb); graphic_buffer_destroy(mem->offline_gb); + memset(lcd, 0x00, sizeof(lcd_mem_t)); TKMEM_FREE(lcd); return RET_OK;