summaryrefslogtreecommitdiff
path: root/nuttx/mm
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-25 13:46:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-25 13:46:14 -0600
commitf28eff61aeb62c867249c8cb21162dbd3c60cc37 (patch)
treec1c8b6d68fb43d3ae59c3eb589e6a4c44acdcd57 /nuttx/mm
parent3b3fcf2bfa6015d890d42b5a528f7fe7476632f7 (diff)
downloadnuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.tar.gz
nuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.tar.bz2
nuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.zip
More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs.
Diffstat (limited to 'nuttx/mm')
-rw-r--r--nuttx/mm/mm_heap/mm_malloc.c2
-rw-r--r--nuttx/mm/mm_heap/mm_realloc.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/nuttx/mm/mm_heap/mm_malloc.c b/nuttx/mm/mm_heap/mm_malloc.c
index 20b1916c8..9890e5712 100644
--- a/nuttx/mm/mm_heap/mm_malloc.c
+++ b/nuttx/mm/mm_heap/mm_malloc.c
@@ -91,7 +91,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
/* Handle bad sizes */
- if (size <= 0)
+ if (size < 1)
{
return NULL;
}
diff --git a/nuttx/mm/mm_heap/mm_realloc.c b/nuttx/mm/mm_heap/mm_realloc.c
index f41d019b5..5778975f5 100644
--- a/nuttx/mm/mm_heap/mm_realloc.c
+++ b/nuttx/mm/mm_heap/mm_realloc.c
@@ -101,7 +101,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
/* If size is zero, then realloc is equivalent to free */
- if (size <= 0)
+ if (size < 1)
{
mm_free(heap, oldmem);
return NULL;
@@ -170,7 +170,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
* previous chunk is smaller than the next chunk.
*/
- if (prevsize > 0 && (nextsize >= prevsize || nextsize <= 0))
+ if (prevsize > 0 && (nextsize >= prevsize || nextsize < 1))
{
/* Can we get everything we need from the previous chunk? */