Browse Source

[HUST CSE]Assign Null to fdt after free to avoid dangling pointer (#7389)

OnlyShirley 2 years ago
parent
commit
8dfcf07c24
1 changed files with 1 additions and 0 deletions
  1. 1 0
      components/drivers/fdt/src/dtb_load.c

+ 1 - 0
components/drivers/fdt/src/dtb_load.c

@@ -52,6 +52,7 @@ void *dtb_node_load_from_fs(char *dtb_filename)
         if (dtb_node_check(fdt) == RT_FALSE)
         {
             free(fdt);
+            fdt=NULL;
         }
     }