You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2019/10/21 09:30:25 UTC

[mynewt-core] 04/23: Ensuring if fcb->scratch is initialized to NULL, it stays that way.

This is an automated email from the ASF dual-hosted git repository.

marko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 40804235ec271b2e53170d00de75f8459cb06575
Author: Nolan Lau <no...@juul.com>
AuthorDate: Wed Oct 16 15:39:04 2019 -0700

    Ensuring if fcb->scratch is initialized to NULL, it stays that way.
---
 fs/fcb/src/fcb_rotate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/fcb/src/fcb_rotate.c b/fs/fcb/src/fcb_rotate.c
index d9c7bf2..ba2ab96 100644
--- a/fs/fcb/src/fcb_rotate.c
+++ b/fs/fcb/src/fcb_rotate.c
@@ -48,8 +48,9 @@ fcb_rotate(struct fcb *fcb)
         fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area);
         fcb->f_active_id++;
     }
-    fcb->f_scratch = fcb->f_oldest;
-
+    if(fcb->f_scratch) {
+        fcb->f_scratch = fcb->f_oldest;
+    }
     fcb->f_oldest = fcb_getnext_area(fcb, fcb->f_oldest);
 out:
     os_mutex_release(&fcb->f_mtx);