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 2023/01/17 18:11:23 UTC

[nuttx] 01/04: rpmsg_socket: release tx buffer when send_oncopy failed

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/nuttx.git

commit c0735f06f6381ee72fd55327e772aea6426edc90
Author: ligd <li...@xiaomi.com>
AuthorDate: Thu Jan 5 00:24:43 2023 +0800

    rpmsg_socket: release tx buffer when send_oncopy failed
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 net/rpmsg/rpmsg_sockif.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c
index 9ad0711873..93d85657bb 100644
--- a/net/rpmsg/rpmsg_sockif.c
+++ b/net/rpmsg/rpmsg_sockif.c
@@ -1010,6 +1010,7 @@ static ssize_t rpmsg_socket_send_continuous(FAR struct socket *psock,
                                 conn->ept.dest_addr);
       if (ret < 0)
         {
+          rpmsg_release_tx_buffer(&conn->ept, msg);
           break;
         }
 
@@ -1109,6 +1110,10 @@ static ssize_t rpmsg_socket_send_single(FAR struct socket *psock,
   nxmutex_unlock(&conn->sendlock);
 
   ret = rpmsg_sendto_nocopy(&conn->ept, msg, total, conn->ept.dest_addr);
+  if (ret < 0)
+    {
+      rpmsg_release_tx_buffer(&conn->ept, msg);
+    }
 
   return ret > 0 ? len : ret;
 }