Source-Changes-HG archive

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

[src/netbsd-1-5]: src/usr.sbin/rpcbind Pull up revision 1.2:



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

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

diffstat:

 usr.sbin/rpcbind/check_bound.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (52 lines):

diff -r 0d2f7813573c -r febe4dc0c47b usr.sbin/rpcbind/check_bound.c
--- a/usr.sbin/rpcbind/check_bound.c    Fri Jun 23 08:13:47 2000 +0000
+++ b/usr.sbin/rpcbind/check_bound.c    Fri Jun 23 08:15:13 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: check_bound.c,v 1.1 2000/06/02 23:15:41 fvdl Exp $     */
+/*     $NetBSD: check_bound.c,v 1.1.2.1 2000/06/23 08:15:13 hannken Exp $      */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -92,12 +92,15 @@
                return (TRUE); /* punt, should never happen */
 
        fd = __rpc_nconf2fd(fdl->nconf);
-       if (fd < 0)
+       if (fd < 0) {
+               free(na);
                return (TRUE);
+       }
 
        ans = bind(fd, (struct sockaddr *)na->buf, na->len);
 
        close(fd);
+       free(na);
 
        return (ans == 0 ? FALSE : TRUE);
 }
@@ -154,7 +157,7 @@
 mergeaddr(SVCXPRT *xprt, char *netid, char *uaddr, char *saddr)
 {
        struct fdlist *fdl;
-       char *c_uaddr, *s_uaddr, *m_uaddr;
+       char *c_uaddr, *s_uaddr, *m_uaddr, *allocated_uaddr = NULL;
 
        for (fdl = fdhead; fdl; fdl = fdl->next)
                if (strcmp(fdl->nconf->nc_netid, netid) == 0)
@@ -178,6 +181,7 @@
                                fdl->nconf->nc_netid);
                        return (NULL);
                }
+               allocated_uaddr = c_uaddr;
        }
 
 #ifdef ND_DEBUG
@@ -201,6 +205,8 @@
                fprintf(stderr, "mergeaddr: uaddr = %s, merged uaddr = %s\n",
                                uaddr, m_uaddr);
 #endif
+       if (allocated_uaddr != NULL)
+               free(allocated_uaddr);
        return (m_uaddr);
 }
 



Home | Main Index | Thread Index | Old Index