Skip to content

Commit 1868af1

Browse files
committed
Free file object structure (FIL) member
Fix #13 Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 6f22836 commit 1868af1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/SD.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,15 +378,18 @@ void File::close()
378378
{
379379
if (_name) {
380380
#if _FATFS == 68300
381-
if (_fil && _fil->obj.fs != 0) {
381+
if (_fil) {
382+
if (_fil->obj.fs != 0) {
382383
#else
383-
if (_fil && _fil->fs != 0) {
384+
if (_fil) {
385+
if (_fil->fs != 0) {
384386
#endif
385-
/* Flush the file before close */
386-
f_sync(_fil);
387+
/* Flush the file before close */
388+
f_sync(_fil);
387389

388-
/* Close the file */
389-
f_close(_fil);
390+
/* Close the file */
391+
f_close(_fil);
392+
}
390393
free(_fil);
391394
}
392395

0 commit comments

Comments
 (0)