File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,6 @@ OsiTaskHandle svTaskHandle;
9898 DECLARE PRIVATE DATA
9999 ******************************************************************************/
100100static fs_user_mount_t * sflash_vfs_fat ;
101- static mp_vfs_mount_t sflash_vfs_mount ;
102101
103102static const char fresh_main_py [] = "# main.py -- put your code here!\r\n" ;
104103static const char fresh_boot_py [] = "# boot.py -- run on boot-up\r\n"
@@ -328,11 +327,16 @@ STATIC void mptask_init_sflash_filesystem (void) {
328327 mptask_create_main_py ();
329328 }
330329 } else {
330+ fail :
331331 __fatal_error ("failed to create /flash" );
332332 }
333333
334334 // mount the flash device (there should be no other devices mounted at this point)
335- mp_vfs_mount_t * vfs = & sflash_vfs_mount ;
335+ // we allocate this structure on the heap because vfs->next is a root pointer
336+ mp_vfs_mount_t * vfs = m_new_obj_maybe (mp_vfs_mount_t );
337+ if (vfs == NULL ) {
338+ goto fail ;
339+ }
336340 vfs -> str = "/flash" ;
337341 vfs -> len = 6 ;
338342 vfs -> obj = MP_OBJ_FROM_PTR (vfs_fat );
You can’t perform that action at this time.
0 commit comments