bug-hurd
[Top][All Lists]
Advanced

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

memory leak in pflocal


From: Marcus Brinkmann
Subject: memory leak in pflocal
Date: Sun, 11 Feb 2001 02:11:39 +0100
User-agent: Mutt/1.1.4i

Hi,

looks like a memory leak in pfinet, but I have not tried to find a test case
or test the fix (I am currently very busy, sorry), so I am not checking it
in right away.

Listen queues (and the queue array they contain) are possibly created but
nowhere destroyed.

Thanks,
Marcus

diff -ru pflocal.pri/ChangeLog pflocal/ChangeLog
--- pflocal.pri/ChangeLog       Sat Aug 12 19:43:08 2000
+++ pflocal/ChangeLog   Sun Feb 11 02:08:37 2001
@@ -1,3 +1,9 @@
+2001-02-11  Marcus Brinkmann  <marcus@gnu.org>
+
+       * connq.c (connq_destroy): New function.
+       * connq.h: Prototype connq_destroy.
+       * sock.c (sock_free): Call connq_destroy when queue exists.
+
 2000-08-09  Mark Kettenis  <kettenis@gnu.org>
 
        * pf.c (S_socket_create): Only accept S_IFCHR, S_IFSOCK and
diff -ru pflocal.pri/connq.c pflocal/connq.c
--- pflocal.pri/connq.c Mon Oct  7 20:13:27 1996
+++ pflocal/connq.c     Sun Feb 11 02:05:43 2001
@@ -108,6 +108,15 @@
   *cq = new;
   return 0;
 }
+
+/* Destroy a listening queue.  */
+void
+connq_destroy (struct connq *cq)
+{
+  if (cq->queue)
+    free (cq->queue);
+  free (cq);
+}
 
 /* ---------------------------------------------------------------- */
 
diff -ru pflocal.pri/connq.h pflocal/connq.h
--- pflocal.pri/connq.h Tue Aug 29 23:55:21 1995
+++ pflocal/connq.h     Sun Feb 11 02:06:27 2001
@@ -33,6 +33,9 @@
    is already listening (change this with connq_set_length).  */
 error_t connq_create (struct connq **cq);
 
+/* Destroy a listening queue.  */
+void connq_destroy (struct connq *cq);
+
 /* Wait for a connection attempt to be made on CQ, and return the connecting
    socket in SOCK, and a request tag in REQ.  If REQ is NULL, the request is
    left in the queue, otherwise connq_request_complete must be called on REQ
diff -ru pflocal.pri/sock.c pflocal/sock.c
--- pflocal.pri/sock.c  Fri Aug  4 23:07:34 2000
+++ pflocal/sock.c      Sun Feb 11 02:08:40 2001
@@ -136,6 +136,8 @@
   sock_shutdown (sock, SOCK_SHUTDOWN_READ | SOCK_SHUTDOWN_WRITE);
   if (sock->id != MACH_PORT_NULL)
     mach_port_destroy (mach_task_self (), sock->id);
+  if (sock->listen_queue)
+    connq_destroy (sock->listen_queue);
   free (sock);
 }
 

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]