Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 3f0d5f502 -> abac41c81


MYNEWT-568 log_cbmem - Garbage last entry.

If the cbmem is empty, a request for last entry should retrieve nothing.
Currently, it retrieves a garbage entry.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/abac41c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/abac41c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/abac41c8

Branch: refs/heads/develop
Commit: abac41c81d64a313363d0a7fa6bb3db0bdcf1a72
Parents: 3f0d5f5
Author: Christopher Collins <[email protected]>
Authored: Fri Jan 27 11:23:13 2017 -0800
Committer: Christopher Collins <[email protected]>
Committed: Fri Jan 27 11:28:53 2017 -0800

----------------------------------------------------------------------
 sys/log/full/src/log_cbmem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/abac41c8/sys/log/full/src/log_cbmem.c
----------------------------------------------------------------------
diff --git a/sys/log/full/src/log_cbmem.c b/sys/log/full/src/log_cbmem.c
index b290e6c..c8f9d93 100644
--- a/sys/log/full/src/log_cbmem.c
+++ b/sys/log/full/src/log_cbmem.c
@@ -75,7 +75,9 @@ log_cbmem_walk(struct log *log, log_walk_func_t walk_func,
      */
     if (log_offset->lo_ts < 0) {
         hdr = cbmem->c_entry_end;
-        rc = walk_func(log, log_offset, (void *)hdr, hdr->ceh_len);
+        if (hdr != NULL) {
+            rc = walk_func(log, log_offset, (void *)hdr, hdr->ceh_len);
+        }
     } else {
         cbmem_iter_start(cbmem, &iter);
         while (1) {

Reply via email to