apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/network_io/win32 sockets.c
Date Mon, 26 Nov 2001 15:53:37 GMT
bnicholes    01/11/26 07:53:37

  Modified:    network_io/unix sockets.c
               network_io/win32 sockets.c
  Log:
  Fixed a memory leak in apr_accept.  Prevents memory from continually
  being allocated and never freed until the process goes down.
  
  Revision  Changes    Path
  1.89      +7 -0      apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockets.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- sockets.c	2001/11/08 00:30:50	1.88
  +++ sockets.c	2001/11/26 15:53:37	1.89
  @@ -220,6 +220,13 @@
           return errno;
       }
       *(*new)->local_addr = *sock->local_addr;
  +
  +    /* The above assignment just overwrote the pool entry. Setting the local_addr 
  +       pool for the accepted socket back to what it should be.  Otherwise all 
  +       allocations for this socket will come from a server pool that is not
  +       freed until the process goes down.*/
  +    (*new)->local_addr->pool = p;
  +
       /* fix up any pointers which are no longer valid */
       if (sock->local_addr->sa.sin.sin_family == AF_INET) {
           (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr;
  
  
  
  1.66      +7 -0      apr/network_io/win32/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sockets.c,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- sockets.c	2001/08/09 23:28:38	1.65
  +++ sockets.c	2001/11/26 15:53:37	1.66
  @@ -245,6 +245,13 @@
           return apr_get_netos_error();
       }
       *(*new)->local_addr = *sock->local_addr;
  +
  +    /* The above assignment just overwrote the pool entry. Setting the local_addr 
  +       pool for the accepted socket back to what it should be.  Otherwise all 
  +       allocations for this socket will come from a server pool that is not
  +       freed until the process goes down.*/
  +    (*new)->local_addr->pool = p;
  +
       /* fix up any pointers which are no longer valid */
       if (sock->local_addr->sa.sin.sin_family == AF_INET) {
           (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr;
  
  
  

Mime
View raw message