diff --git a/src/etcp.c b/src/etcp.c index 361470ff..210a56a6 100644 --- a/src/etcp.c +++ b/src/etcp.c @@ -1294,7 +1294,7 @@ void etcp_conn_input(struct ETCP_DGRAM* pkt) { uint16_t len = pkt->data_len; uint16_t ts = pkt->timestamp; // Received timestamp - DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "[%s] RX pkt", etcp->log_name); + DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "[%s] RX pkt dlen=%d", etcp->log_name, len); while (len >= 1) { uint8_t type = data[0]; @@ -1549,6 +1549,12 @@ void etcp_conn_input(struct ETCP_DGRAM* pkt) { } + if (memory_pool_is_freed(pkt->link->etcp->instance->pkt_pool, pkt)) { + DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "etcp_conn_input: pkt=%p ALREADY FREED in pkt_pool — HALTING", (void*)pkt); + volatile int _halt = 1; while (_halt) {} + } + + memory_pool_free(etcp->instance->pkt_pool, pkt); // Free the incoming dgram }