Merge branch 'bugfix/fix_crash_when_heap_leaks' into 'release/v2.1'

lfix pbuf_free when DRAM lacks

See merge request sdk/ESP8266_RTOS_SDK!1161
This commit is contained in:
Dong Heng
2019-11-04 14:17:28 +08:00
2 changed files with 3 additions and 0 deletions

Binary file not shown.

View File

@ -303,6 +303,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
(PBUF_POOL_BUFSIZE_ALIGNED - LWIP_MEM_ALIGN_SIZE(offset)) > 0 ); (PBUF_POOL_BUFSIZE_ALIGNED - LWIP_MEM_ALIGN_SIZE(offset)) > 0 );
/* set reference count (needed here in case we fail) */ /* set reference count (needed here in case we fail) */
p->ref = 1; p->ref = 1;
p->eb = NULL;
/* now allocate the tail of the pbuf chain */ /* now allocate the tail of the pbuf chain */
@ -337,6 +338,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
((u8_t*)p->payload + p->len <= ((u8_t*)p->payload + p->len <=
(u8_t*)p + SIZEOF_STRUCT_PBUF + PBUF_POOL_BUFSIZE_ALIGNED)); (u8_t*)p + SIZEOF_STRUCT_PBUF + PBUF_POOL_BUFSIZE_ALIGNED));
q->ref = 1; q->ref = 1;
q->eb = NULL;
/* calculate remaining length to be allocated */ /* calculate remaining length to be allocated */
rem_len -= q->len; rem_len -= q->len;
/* remember this pbuf for linkage in next iteration */ /* remember this pbuf for linkage in next iteration */
@ -382,6 +384,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
p->len = p->tot_len = length; p->len = p->tot_len = length;
p->next = NULL; p->next = NULL;
p->type = type; p->type = type;
p->eb = NULL;
break; break;
default: default:
LWIP_ASSERT("pbuf_alloc: erroneous type", 0); LWIP_ASSERT("pbuf_alloc: erroneous type", 0);