mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 14:41:29 +08:00
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:
committed by
Gregory Nutt
parent
681609ad51
commit
2d0f1b85e3
@@ -252,13 +252,16 @@ FAR struct tcp_wrbuffer_s *tcp_wrbuffer_tryalloc(void)
|
|||||||
|
|
||||||
void tcp_wrbuffer_release(FAR struct tcp_wrbuffer_s *wrb)
|
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
|
/* To avoid deadlocks, we must following this ordering: Release the I/O
|
||||||
* buffer chain first, then the write buffer structure.
|
* 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 */
|
/* Then free the write buffer structure */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user