LVGL fix crash in file system

This commit is contained in:
Stephan Hadinger 2021-05-21 09:02:24 +02:00
parent 6d35b2707e
commit 74445c0aaa
2 changed files with 3 additions and 2 deletions

View File

@ -148,7 +148,9 @@ lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p)
lv_fs_res_t res = file_p->drv->close_cb(file_p->drv, file_p->file_d);
lv_mem_free(file_p->file_d); /*Clean up*/
if(file_p->drv->file_size != 0) { /*Is file_d zero size?*/
lv_mem_free(file_p->file_d); /*Clean up*/
}
file_p->file_d = NULL;
file_p->drv = NULL;

View File

@ -219,7 +219,6 @@ static lv_fs_res_t lvbe_fs_open(lv_fs_drv_t * drv, void * file_p, const char * p
// AddLog(LOG_LEVEL_INFO, "LVG: F=%*_H", sizeof(f), &f);
if (f) {
File * f_ptr = new File(f); // copy to dynamic object
*f_ptr = f; // TODO is this necessary?
*((File**)file_p) = f_ptr;
return LV_FS_RES_OK;
} else {