1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-14 23:33:23 +00:00

Fixed memory leaks

This commit is contained in:
Gerhard Rieger 2015-01-06 13:07:15 +01:00
parent 281d1bd651
commit ca872c9a9f
3 changed files with 18 additions and 3 deletions

View file

@ -790,6 +790,7 @@ int _socat(void) {
if (total_timeout.tv_sec < 0 ||
total_timeout.tv_sec == 0 && total_timeout.tv_usec < 0) {
Notice("inactivity timeout triggered");
free(buff);
return 0;
}
}
@ -902,6 +903,7 @@ int _socat(void) {
fds[0].fd, fds[0].events, fds[1].fd, fds[1].events,
fds[2].fd, fds[2].events, fds[3].fd, fds[3].events,
timeout.tv_sec, timeout.tv_usec, strerror(errno));
free(buff);
return -1;
} else if (retval == 0) {
Info2("poll timed out (no data within %ld.%06ld seconds)",
@ -923,6 +925,7 @@ int _socat(void) {
socat_opts.total_timeout.tv_usec != 0) {
/* there was a total inactivity timeout */
Notice("inactivity timeout triggered");
free(buff);
return 0;
}
@ -941,6 +944,7 @@ int _socat(void) {
named pipe. a read() might imm. return with 0 bytes, resulting
in a loop? */
Error1("poll(...[%d]: invalid request", fd1in->fd);
free(buff);
return -1;
}
mayrd1 = true;
@ -949,6 +953,7 @@ int _socat(void) {
(fd2in->revents)) {
if (fd2in->revents & POLLNVAL) {
Error1("poll(...[%d]: invalid request", fd2in->fd);
free(buff);
return -1;
}
mayrd2 = true;
@ -956,6 +961,7 @@ int _socat(void) {
if (XIO_GETWRFD(sock1) >= 0 && fd1out->fd >= 0 && fd1out->revents) {
if (fd1out->revents & POLLNVAL) {
Error1("poll(...[%d]: invalid request", fd1out->fd);
free(buff);
return -1;
}
maywr1 = true;
@ -963,6 +969,7 @@ int _socat(void) {
if (XIO_GETWRFD(sock2) >= 0 && fd2out->fd >= 0 && fd2out->revents) {
if (fd2out->revents & POLLNVAL) {
Error1("poll(...[%d]: invalid request", fd2out->fd);
free(buff);
return -1;
}
maywr2 = true;
@ -1088,6 +1095,7 @@ int _socat(void) {
xioclose(sock1);
xioclose(sock2);
free(buff);
return 0;
}