1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Free the correct buffer in error handling.

Handle that malloc may return NULL.

NetBSD Rev. 1.8

Reviewed by:		phk
Obtained from:		NetBSD
This commit is contained in:
Martin Blapp 2003-01-27 22:22:59 +00:00
parent 40525d3deb
commit b951fbe40c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109951

View File

@ -688,6 +688,8 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
}
ret = (struct netbuf *)malloc(sizeof *ret);
if (ret == NULL)
goto out;
switch (af) {
case AF_INET:
@ -715,7 +717,7 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
sin6->sin6_family = AF_INET6;
sin6->sin6_port = htons(port);
if (inet_pton(AF_INET6, addrstr, &sin6->sin6_addr) <= 0) {
free(sin);
free(sin6);
free(ret);
ret = NULL;
goto out;