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 3bd4748bc3bc50b590ecf326e8d918f2c2ab8599
Author: wangjinjing1 <[email protected]>
AuthorDate: Wed May 21 15:55:58 2025 +0800

    net/can: repair callback alloc error handling
    
    Release the corresponding resources held when the alloc fails
    
    Signed-off-by: wangjinjing1 <[email protected]>
---
 net/can/can_sendmsg_buffered.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/can/can_sendmsg_buffered.c b/net/can/can_sendmsg_buffered.c
index eb9442d3824..98389388ef7 100644
--- a/net/can/can_sendmsg_buffered.c
+++ b/net/can/can_sendmsg_buffered.c
@@ -377,7 +377,8 @@ ssize_t can_sendmsg(FAR struct socket *psock, FAR struct 
msghdr *msg,
           /* A buffer allocation error occurred */
 
           nerr("ERROR: Failed to allocate callback\n");
-          return -ENOMEM;
+          ret = -ENOMEM;
+          goto errout_with_wrb;
         }
 
       /* Set up the callback in the connection */

Reply via email to