]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r300932,r300934,r300941,r300972,r300973:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 8 Jun 2016 17:04:15 +0000 (17:04 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 8 Jun 2016 17:04:15 +0000 (17:04 +0000)
commit1208ec62e147ca21d7b7c7e5811427d53691b86d
treeb684c738f420b4c552f4082ecc3c34d33b1dd098
parentc927627c9bcaed6826b1936c339c3eda3dae13e6
MFC r300932,r300934,r300941,r300972,r300973:

r300932:

Catch malloc(3) errors and socket(2) errors

- malloc failing will result in a delayed segfault
- socket failing will result in delayed failures with setsockopt

Exit in the event that either of these high-level conditions are met.

CID: 976288, 976321, 976858

r300934:

Plug leak with ifp by calling freeifaddrs after calling getifaddrs

Obtained from: NetBSD v1.18

r300941:

Don't leak res in network_init(..)

Call freeaddrinfo on it after it's been used

CID: 1225050

r300972 (by markj):

Fix rpcbind init after r300941.

- getaddrinfo() sets res = NULL on failure and freeaddrinfo() always
  dereferences its argument, so we should only free the address list after
  a successful call.
- Address a second potential leak caused by getaddrinfo(AF_INET6)
  overwriting the address list returned by getaddrinfo(AF_INET).

X-MFC-With: r300941

r300973:

Follow up to r300932

In the event MK_INET6 != no in userspace, but is disabled in the
kernel, or if there aren't any IPv6 addresses configured in userspace
(for lo0 and all physical interfaces), rpcbind would terminate
immediately instead of silently failing on

Skip over the IPv6 block to its respective cleanup with freeifaddrs if
creating the socket failed instead of terminating rpcbind immediately

git-svn-id: svn://svn.freebsd.org/base/stable/9@301643 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.sbin/rpcbind/util.c