ryansturmer / thinfat32

A lightweight implementation of the fat32 filesystem specification in C for embedded systems.
MIT License
101 stars 25 forks source link

Free cluster chain error results in disk leakage #9

Open stayclean opened 5 years ago

stayclean commented 5 years ago

In free cluster chain func: two mistakes:

  1. fat_entry starts from FAT[cluster], and in the while loop, the fat_entry is updated again before set FAT[cluster] to 0x0, thus cause the FAT[cluster] not dereferenced.

  2. The last eoc in fat not been released!

This cause 2 clusters leakage in a single free cluster call.