1
1

Don't free memory in uninitialized structures

Also, tighten up the scope/lifetime of some memory structures.

Inspired by #577.
Этот коммит содержится в:
Bruce A. Mah 2017-05-12 09:12:48 -07:00
родитель ec04a41e78
Коммит d54d49c0ac
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4984910A8CAAEE8A

Просмотреть файл

@ -136,8 +136,6 @@ iperf_tcp_accept(struct iperf_test * test)
int
iperf_tcp_listen(struct iperf_test *test)
{
struct addrinfo hints, *res;
char portstr[6];
int s, opt;
socklen_t optlen;
int saved_errno;
@ -155,6 +153,9 @@ iperf_tcp_listen(struct iperf_test *test)
* It's not clear whether this is a requirement or a convenience.
*/
if (test->no_delay || test->settings->mss || test->settings->socket_bufsize) {
struct addrinfo hints, *res;
char portstr[6];
FD_CLR(s, &test->read_set);
close(s);
@ -305,7 +306,6 @@ iperf_tcp_listen(struct iperf_test *test)
if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &sndbuf_actual, &optlen) < 0) {
saved_errno = errno;
close(s);
freeaddrinfo(res);
errno = saved_errno;
i_errno = IESETBUF;
return -1;
@ -323,7 +323,6 @@ iperf_tcp_listen(struct iperf_test *test)
if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, &rcvbuf_actual, &optlen) < 0) {
saved_errno = errno;
close(s);
freeaddrinfo(res);
errno = saved_errno;
i_errno = IESETBUF;
return -1;