diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp index 3f6c136bcb152b..c4e1245cba7613 100644 --- a/src/system/SystemPacketBuffer.cpp +++ b/src/system/SystemPacketBuffer.cpp @@ -431,6 +431,7 @@ void PacketBuffer::AddRef() pbuf_ref(this); #else // !CHIP_SYSTEM_CONFIG_USE_LWIP LOCK_BUF_POOL(); + assert(this->ref < UINT16_MAX); ++this->ref; UNLOCK_BUF_POOL(); #endif // !CHIP_SYSTEM_CONFIG_USE_LWIP