summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-02-09 16:09:59 +0100
committerAndreas Schneider <asn@samba.org>2021-02-09 16:53:48 +0100
commitdb594f106d9737e0415a268439fc9003bb636473 (patch)
tree6b4a580295944454a47fd4608402e0805e3f0f7e
parent2b8a9e3255f2c9bf440cbae404ca8ac8f3f910f6 (diff)
downloadsocket_wrapper-db594f106d9737e0415a268439fc9003bb636473.tar.gz
socket_wrapper-db594f106d9737e0415a268439fc9003bb636473.tar.xz
socket_wrapper-db594f106d9737e0415a268439fc9003bb636473.zip
swrap: don't touch msg_tmp in swrap_recvmsg_after_unix() on error
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--src/socket_wrapper.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 6a63530..59fb07d 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -6021,6 +6021,16 @@ static ssize_t swrap_recvmsg_after_unix(struct msghdr *msg_tmp,
size_t cm_data_space = 0;
int rc = -1;
+ if (ret < 0) {
+ int saved_errno = errno;
+ SWRAP_LOG(SWRAP_LOG_TRACE, "ret=%zd - %d - %s", ret,
+ saved_errno, strerror(saved_errno));
+ SAFE_FREE(*tmp_control);
+ /* msg_out should not be touched on error */
+ errno = saved_errno;
+ return ret;
+ }
+
SWRAP_LOG(SWRAP_LOG_TRACE,
"msg_tmp->msg_controllen=%zu",
(size_t)msg_tmp->msg_controllen);