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