]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Wed, 15 Nov 2000 09:32:53 +0000 (09:32 +0000)
committerwessels <>
Wed, 15 Nov 2000 09:32:53 +0000 (09:32 +0000)
 - My recent clientLifetimeTimeout addition causes a memory leak because
   cbdata was locked, but never unlocked  if the timeout never happens.
   Maybe its safe enough to assume that if the FD is open, and the
   timeout triggers, that 'http' is valid.

src/client_side.cc

index 0802e3a48ab77be6f700a3286b934e6115642026..fb7cffbe68ce3bd1ec57279c7155d680539f4df1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.512 2000/11/13 12:25:11 adrian Exp $
+ * $Id: client_side.cc,v 1.513 2000/11/15 02:32:53 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -2581,7 +2581,13 @@ clientReadRequest(int fd, void *data)
            for (H = &conn->chr; *H; H = &(*H)->next);
            *H = http;
            conn->nrequests++;
-           cbdataLock(http);   /* lock for clientLifetimeTimeout() */
+           /*
+            * I wanted to lock 'http' here since its callback data for 
+            * clientLifetimeTimeout(), but there's no logical place to
+            * cbdataUnlock if the timeout never happens.  Maybe its safe
+            * enough to assume that if the FD is open, and the timeout
+            * triggers, that 'http' is valid.
+            */
            commSetTimeout(fd, Config.Timeout.lifetime, clientLifetimeTimeout, http);
            if (parser_return_code < 0) {
                debug(33, 1) ("clientReadRequest: FD %d Invalid Request\n", fd);
@@ -2798,12 +2804,7 @@ static void
 clientLifetimeTimeout(int fd, void *data)
 {
     clientHttpRequest *http = data;
-    ConnStateData *conn;
-    int valid = cbdataValid(http);
-    cbdataUnlock(http);
-    if (!valid)
-       return;
-    conn = http->conn;
+    ConnStateData *conn = http->conn;
     debug(33, 1) ("WARNING: Closing client %s connection due to lifetime timeout\n",
        inet_ntoa(conn->peer.sin_addr));
     debug(33, 1) ("\t%s\n", http->uri);