Fix a bug where null pointers were not judged

This commit is contained in:
Andrew12138-w 2023-04-18 20:42:45 +08:00 committed by GitHub
parent e3159c6526
commit 53f7e6e1c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -412,16 +412,18 @@ uint16_t MEM_BufferGetSize(void *buffer) /* IN: Block of memory to get size*/
uint32_t regPrimask = DisableGlobalIRQ();
if(buffer==NULL)
{
EnableGlobalIRQ(regPrimask);
return 0;
}
pBlock = (block_list_header_t *)buffer - 1;
pParentPool = (mem_pool_structure_t *)pBlock->pParentPool;
if (buffer != NULL)
{
EnableGlobalIRQ(regPrimask);
return pParentPool->blockSize;
}
EnableGlobalIRQ(regPrimask);
return 0;
return pParentPool->blockSize;
}
/*!