diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/rpc/svc_vc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c index 50c6651..6fcbb21 100644 --- a/lib/libc/rpc/svc_vc.c +++ b/lib/libc/rpc/svc_vc.c @@ -135,13 +135,14 @@ svc_vc_create(fd, sendsize, recvsize) struct sockaddr_storage sslocal; socklen_t slen; + if (!__rpc_fd2sockinfo(fd, &si)) + return NULL; + r = mem_alloc(sizeof(*r)); if (r == NULL) { warnx("svc_vc_create: out of memory"); goto cleanup_svc_vc_create; } - if (!__rpc_fd2sockinfo(fd, &si)) - return NULL; r->sendsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsize); r->recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize); r->maxrec = __svc_maxrec; @@ -177,6 +178,8 @@ svc_vc_create(fd, sendsize, recvsize) xprt_register(xprt); return (xprt); cleanup_svc_vc_create: + if (xprt) + mem_free(xprt, sizeof(*xprt)); if (r != NULL) mem_free(r, sizeof(*r)); return (NULL); |