You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/17 14:06:58 UTC

[incubator-nuttx] branch master updated: /mm/mm_heap/mm_mallinfo.c: Fix assertion broken in 312ea9f9.

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

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new ea72d84  /mm/mm_heap/mm_mallinfo.c: Fix assertion broken in 312ea9f9.
ea72d84 is described below

commit ea72d84c4d673a486aaf052a81ec8e60d7e5d053
Author: Juha Niskanen <ju...@haltian.com>
AuthorDate: Mon Feb 17 08:06:46 2020 -0600

    /mm/mm_heap/mm_mallinfo.c: Fix assertion broken in 312ea9f9.
---
 mm/mm_heap/mm_mallinfo.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mm/mm_heap/mm_mallinfo.c b/mm/mm_heap/mm_mallinfo.c
index dd980d1..d13ed66 100644
--- a/mm/mm_heap/mm_mallinfo.c
+++ b/mm/mm_heap/mm_mallinfo.c
@@ -61,7 +61,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
 {
   FAR struct mm_allocnode_s *node;
 #ifdef CONFIG_DEBUG_ASSERTIONS
-  FAR struct mm_allocnode_s *prev = NULL;
+  FAR struct mm_allocnode_s *prev;
 #endif
   size_t mxordblk = 0;
   int    ordblks  = 0;  /* Number of non-inuse chunks */
@@ -81,6 +81,9 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
   for (region = 0; region < heap->mm_nregions; region++)
 #endif
     {
+#ifdef CONFIG_DEBUG_ASSERTIONS
+      prev = NULL;
+#endif
       /* Visit each node in the region
        * Retake the semaphore for each region to reduce latencies
        */
@@ -124,11 +127,12 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
                   mxordblk = node->size;
                 }
             }
+
+          DEBUGASSERT(prev == NULL ||
+                      prev->size == (node->preceding & ~MM_ALLOC_BIT));
 #ifdef CONFIG_DEBUG_ASSERTIONS
           prev = node;
 #endif
-          DEBUGASSERT(prev == NULL ||
-                      prev->size == (node->preceding & ~MM_ALLOC_BIT));
         }
 
       minfo("region=%d node=%p heapend=%p\n",