summaryrefslogtreecommitdiffstats
path: root/lib/socket_wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'lib/socket_wrapper')
-rw-r--r--lib/socket_wrapper/socket_wrapper.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c
index c5b1fdf85e..5ed9d9fa73 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -3155,7 +3155,7 @@ static int swrap_recvmsg_after(int fd,
{
int saved_errno = errno;
size_t i;
- uint8_t *buf;
+ uint8_t *buf = NULL;
off_t ofs = 0;
size_t avail = 0;
size_t remain;
@@ -3187,7 +3187,7 @@ static int swrap_recvmsg_after(int fd,
/* we capture it as one single packet */
buf = (uint8_t *)malloc(remain);
- if (!buf) {
+ if (buf == NULL) {
/* we just not capture the packet */
errno = saved_errno;
return -1;
@@ -3228,7 +3228,7 @@ static int swrap_recvmsg_after(int fd,
msg->msg_name,
&msg->msg_namelen);
if (rc == -1) {
- return -1;
+ goto done;
}
swrap_dump_packet(si,
@@ -3247,6 +3247,7 @@ static int swrap_recvmsg_after(int fd,
break;
}
+done:
free(buf);
errno = saved_errno;
return 0;