You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/09/15 04:03:29 UTC
[incubator-nuttx] branch master updated: net/udp: fix buffer
release handling on failed buffer alloc
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e10b546 net/udp: fix buffer release handling on failed buffer alloc
e10b546 is described below
commit e10b54600665f6899bb6ff516c6ef6ac24a9f199
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Aug 30 18:36:39 2021 +0800
net/udp: fix buffer release handling on failed buffer alloc
Attempt to release write buffer on failed UDP write I/O buffer
alloc and tryalloc failed to wrb->wb_iob assertion.
Signed-off-by: chao.an <an...@xiaomi.com>
---
net/udp/udp_wrbuffer.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/udp/udp_wrbuffer.c b/net/udp/udp_wrbuffer.c
index 076300d..9e7b7c7 100644
--- a/net/udp/udp_wrbuffer.c
+++ b/net/udp/udp_wrbuffer.c
@@ -226,13 +226,16 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_tryalloc(void)
void udp_wrbuffer_release(FAR struct udp_wrbuffer_s *wrb)
{
- DEBUGASSERT(wrb && wrb->wb_iob);
+ DEBUGASSERT(wrb);
/* 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, IOBUSER_NET_UDP_WRITEBUFFER);
+ if (wrb->wb_iob)
+ {
+ iob_free_chain(wrb->wb_iob, IOBUSER_NET_UDP_WRITEBUFFER);
+ }
/* Then free the write buffer structure */