Skip to content

Commit

Permalink
rpmsg_socket: release tx buffer when send_oncopy failed
Browse files Browse the repository at this point in the history
Signed-off-by: ligd <[email protected]>
  • Loading branch information
GUIDINGLI authored and xiaoxiang781216 committed Jan 17, 2023
1 parent bc30b29 commit c0735f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/rpmsg/rpmsg_sockif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit c0735f0

Please sign in to comment.