net/tcp/tcp_wrbuffer.c: fix buffer release handling on failed buffer alloc. Attempt to release write buffer on failed TCP write I/O buffer alloc and tryalloc failed to wrb->wb_iob assertion.

This commit is contained in:
Harri Luhtala 2018-09-25 07:02:04 -06:00 committed by Gregory Nutt
parent 681609ad51
commit 2d0f1b85e3

View File

@ -252,13 +252,16 @@ FAR struct tcp_wrbuffer_s *tcp_wrbuffer_tryalloc(void)
void tcp_wrbuffer_release(FAR struct tcp_wrbuffer_s *wrb)
{
DEBUGASSERT(wrb && wrb->wb_iob);
DEBUGASSERT(wrb != NULL);
/* To avoid deadlocks, we must following this ordering: Release the I/O
* buffer chain first, then the write buffer structure.
*/
iob_free_chain(wrb->wb_iob);
if (wrb->wb_iob != NULL)
{
iob_free_chain(wrb->wb_iob);
}
/* Then free the write buffer structure */