mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 00:15:16 +00:00
Fixed bug in mem_realloc (check alignment of size)
This commit is contained in:
parent
01a53d955e
commit
8636ac26cf
@ -192,6 +192,16 @@ mem_realloc(void *rmem, mem_size_t newsize)
|
||||
mem_size_t size;
|
||||
mem_size_t ptr, ptr2;
|
||||
struct mem *mem, *mem2;
|
||||
|
||||
/* Expand the size of the allocated memory region so that we can
|
||||
adjust for alignment. */
|
||||
if((newsize % MEM_ALIGNMENT) != 0) {
|
||||
newsize += MEM_ALIGNMENT - ((newsize + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT);
|
||||
}
|
||||
|
||||
if(newsize > MEM_SIZE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sys_sem_wait(mem_sem);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user