[net][udp] fix udp wrb-iob leak when NIC was down

Signed-off-by: meijian <meijian@xiaomi.com>
This commit is contained in:
meijian 2024-05-07 15:25:39 +08:00 committed by archer
parent c234fac910
commit d199249769
1 changed files with 6 additions and 6 deletions

View File

@ -151,12 +151,6 @@ static void sendto_writebuffer_release(FAR struct udp_conn_s *conn)
wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&conn->write_q);
DEBUGASSERT(wrb != NULL);
/* Do not need to release wb_iob, the life cycle of wb_iob is
* handed over to the network device
*/
wrb->wb_iob = NULL;
udp_wrbuffer_release(wrb);
/* Set up for the next packet transfer by setting the connection
@ -455,6 +449,12 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
dev->d_sndlen = wrb->wb_iob->io_pktlen - udpiplen;
ninfo("wrb=%p sndlen=%d\n", wrb, dev->d_sndlen);
/* Do not need to release wb_iob, the life cycle of wb_iob is
* handed over to the network device
*/
wrb->wb_iob = NULL;
#ifdef NEED_IPDOMAIN_SUPPORT
/* If both IPv4 and IPv6 support are enabled, then we will need to
* select which one to use when generating the outgoing packet.