Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/lib/libc/rpc Pull up revision 1.3:



details:   https://anonhg.NetBSD.org/src/rev/0d2f7813573c
branches:  netbsd-1-5
changeset: 488234:0d2f7813573c
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Jun 23 08:13:47 2000 +0000

description:
Pull up revision 1.3:
  - Fix memory leaks.

diffstat:

 lib/libc/rpc/svc_dg.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 7febd5bfe62c -r 0d2f7813573c lib/libc/rpc/svc_dg.c
--- a/lib/libc/rpc/svc_dg.c     Thu Jun 22 20:26:19 2000 +0000
+++ b/lib/libc/rpc/svc_dg.c     Fri Jun 23 08:13:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svc_dg.c,v 1.2 2000/06/04 04:35:13 thorpej Exp $       */
+/*     $NetBSD: svc_dg.c,v 1.2.2.1 2000/06/23 08:13:47 hannken Exp $   */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -192,9 +192,13 @@
                goto again;
        if (rlen == -1 || (rlen < 4 * sizeof (u_int32_t)))
                return (FALSE);
-       xprt->xp_rtaddr.buf = mem_alloc(alen);
+       if (xprt->xp_rtaddr.len < alen) {
+               if (xprt->xp_rtaddr.len != 0)
+                       mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.len);
+               xprt->xp_rtaddr.buf = mem_alloc(alen);
+               xprt->xp_rtaddr.len = alen;
+       }
        memcpy(xprt->xp_rtaddr.buf, &ss, alen);
-       xprt->xp_rtaddr.len = alen;
 #ifdef PORTMAP
        if (ss.ss_family == AF_INET) {
                xprt->xp_raddr = *(struct sockaddr_in *)xprt->xp_rtaddr.buf;



Home | Main Index | Thread Index | Old Index