net/can: repair callback alloc error handling

Release the corresponding resources held when the alloc fails

Signed-off-by: wangjinjing1 <wangjinjing1@xiaomi.com>
This commit is contained in:
wangjinjing1 2025-05-21 15:55:58 +08:00 committed by Xiang Xiao
parent a22f2a6123
commit 3bd4748bc3

View file

@ -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 */