diff options
author | mbr <mbr@FreeBSD.org> | 2003-01-27 22:22:59 +0000 |
---|---|---|
committer | mbr <mbr@FreeBSD.org> | 2003-01-27 22:22:59 +0000 |
commit | 00bea96dadb6ec6574f7a46ccc58052337f8783d (patch) | |
tree | fd5ee6e7dbee8fda488d31a4d124ff73565e070e | |
parent | 28bc7aa886f5dcc08099c14345c2a74eb44c1ff5 (diff) | |
download | FreeBSD-src-00bea96dadb6ec6574f7a46ccc58052337f8783d.zip FreeBSD-src-00bea96dadb6ec6574f7a46ccc58052337f8783d.tar.gz |
Free the correct buffer in error handling.
Handle that malloc may return NULL.
NetBSD Rev. 1.8
Reviewed by: phk
Obtained from: NetBSD
-rw-r--r-- | lib/libc/rpc/rpc_generic.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/rpc/rpc_generic.c b/lib/libc/rpc/rpc_generic.c index 180b5ee..3e33e6d 100644 --- a/lib/libc/rpc/rpc_generic.c +++ b/lib/libc/rpc/rpc_generic.c @@ -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; |