mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-13 07:14:31 +00:00
pbuf: Fix allocate zero length pbuf
Current code fails to allocate zero length pbuf (e.g. for PBUF_RAW PBUF_POOL), fix it. Fixes: eb269e61b5d3 ("First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
parent
fc7a68b5af
commit
4c9b316e6b
@ -305,7 +305,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
p = NULL;
|
||||
last = NULL;
|
||||
rem_len = length;
|
||||
while (rem_len > 0) {
|
||||
do {
|
||||
q = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL);
|
||||
if (q == NULL) {
|
||||
PBUF_POOL_IS_EMPTY();
|
||||
@ -332,7 +332,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
last = q;
|
||||
rem_len -= q->len;
|
||||
offset = 0;
|
||||
}
|
||||
} while (rem_len > 0);
|
||||
break;
|
||||
}
|
||||
case PBUF_RAM:
|
||||
|
Loading…
x
Reference in New Issue
Block a user