summaryrefslogtreecommitdiff
path: root/lib/libc/rpc/svc_tcp.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-03-03 06:50:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-03-03 06:50:29 +0000
commit5cab98a552d03dd2c7a566504b72afb11b89c84d (patch)
treed522ff9f2cc2db7e245645da75821e6ef16604d2 /lib/libc/rpc/svc_tcp.c
parente823d2c765133cc0851045eae69fa841c7bae557 (diff)
plug many memory leaks
Diffstat (limited to 'lib/libc/rpc/svc_tcp.c')
-rw-r--r--lib/libc/rpc/svc_tcp.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c
index fa1cfcdf1e3..3de72ea6e53 100644
--- a/lib/libc/rpc/svc_tcp.c
+++ b/lib/libc/rpc/svc_tcp.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.18 1998/05/22 04:23:01 deraadt Exp $";
+static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.19 2001/03/03 06:50:28 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -179,7 +179,13 @@ svctcp_create(sock, sendsize, recvsize)
xprt->xp_ops = &svctcp_rendezvous_op;
xprt->xp_port = ntohs(addr.sin_port);
xprt->xp_sock = sock;
- xprt_register(xprt);
+ if (__xprt_register(xprt) == 0) {
+ if (madesock)
+ (void)close(sock);
+ free(r);
+ free(xprt);
+ return (NULL);
+ }
return (xprt);
}
@@ -228,7 +234,11 @@ makefd_xprt(fd, sendsize, recvsize)
xprt->xp_ops = &svctcp_op; /* truely deals with calls */
xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
xprt->xp_sock = fd;
- xprt_register(xprt);
+ if (__xprt_register(xprt) == 0) {
+ free(xprt);
+ free(cd);
+ return (NULL);
+ }
done:
return (xprt);
}