You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "patacongo (via GitHub)" <gi...@apache.org> on 2023/05/02 14:46:57 UTC
[GitHub] [nuttx] patacongo commented on a diff in pull request #9151: mm: memory allocations return valid pointer when request 0 size
patacongo commented on code in PR #9151:
URL: https://github.com/apache/nuttx/pull/9151#discussion_r1182657939
##########
mm/umm_heap/umm_realloc.c:
##########
@@ -83,7 +77,7 @@ FAR void *realloc(FAR void *oldmem, size_t size)
mem = mm_realloc(USR_HEAP, oldmem, size);
if (!mem)
{
- brkaddr = sbrk(size);
+ brkaddr = sbrk(size < 1 ? 1 : size);
Review Comment:
The actual size needed is actually larger than one when size is zero: It is the minimum chunk size.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org