diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 10f73a5f..7cf22c98 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -306,7 +306,7 @@ pbuf_alloc(pbuf_layer l, u16_t length, pbuf_flag flag) break; case PBUF_RAM: /* If pbuf is to be allocated in RAM, allocate memory for it. */ - p = mem_malloc(MEM_ALIGN_SIZE(sizeof(struct pbuf) + length + offset)); + p = mem_malloc(MEM_ALIGN_SIZE(sizeof(struct pbuf) + offset) + MEM_ALIGN_SIZE(length)); if (p == NULL) { return NULL; }