Revision: 14528
Author: adrian.chadd
Date: Fri Apr  2 02:06:29 2010
Log: Issue #99 - begin sorting out the method_t assignment related leaks and overwriting.

Modify the assignment code so overwritten method_t *'s are logged.
There's the unfortunate situation where already set pointers are
overwritten - and if they're METHOD_OTHER pointers, the string
value may leak.

It'll eventually be modified to free the previous value before
assigning it the new value; but that will change existing behaviour!


http://code.google.com/p/lusca-cache/source/detail?r=14528

Modified:
 /branches/LUSCA_HEAD/src/HttpRequest.c
 /branches/LUSCA_HEAD/src/client_side.c
 /branches/LUSCA_HEAD/src/client_side_async_refresh.c
 /branches/LUSCA_HEAD/src/client_side_purge.c
 /branches/LUSCA_HEAD/src/store_vary.c

=======================================
--- /branches/LUSCA_HEAD/src/HttpRequest.c      Wed Mar 24 07:50:24 2010
+++ /branches/LUSCA_HEAD/src/HttpRequest.c      Fri Apr  2 02:06:29 2010
@@ -49,7 +49,7 @@
 {
     request_t *req = memPoolAlloc(pool_request_t);
     if (method)
-        req->method = method;
+        urlMethodAssign(&req->method, method);
     else
         req->method = urlMethodGetKnownByCode(METHOD_NONE);
     req->protocol = protocol;
=======================================
--- /branches/LUSCA_HEAD/src/client_side.c      Sun Mar 21 22:26:07 2010
+++ /branches/LUSCA_HEAD/src/client_side.c      Fri Apr  2 02:06:29 2010
@@ -287,7 +287,7 @@
                packerClean(&p);
                memBufClean(&mb);
            }
-           http->al.http.method = request->method;
+           urlMethodAssign(&http->al.http.method, request->method);
            http->al.http.version = request->http_ver;
            http->al.hier = request->hier;
            if (request->auth_user_request) {
@@ -2181,7 +2181,7 @@
                r->hier = http->entry->mem_obj->request->hier;
        }
        storeCreateMemObject(http->entry, http->uri);
-       http->entry->mem_obj->method = r->method;
+        urlMethodAssign(&http->entry->mem_obj->method, r->method);
        http->sc = storeClientRegister(http->entry, http);
 #if DELAY_POOLS
        delaySetStoreClient(http->sc, delayClient(http));
=======================================
--- /branches/LUSCA_HEAD/src/client_side_async_refresh.c Wed Feb 10 23:17:59 2010 +++ /branches/LUSCA_HEAD/src/client_side_async_refresh.c Fri Apr 2 02:06:29 2010
@@ -55,7 +55,7 @@
        packerClean(&p);
        memBufClean(&mb);
     }
-    al.http.method = request->method;
+    urlMethodAssign(&al.http.method, request->method);
     al.http.version = request->http_ver;
     al.hier = request->hier;
     if (request->auth_user_request) {
=======================================
--- /branches/LUSCA_HEAD/src/client_side_purge.c        Sun Feb 28 06:24:48 2010
+++ /branches/LUSCA_HEAD/src/client_side_purge.c        Fri Apr  2 02:06:29 2010
@@ -69,7 +69,7 @@
            http->entry = entry;
            storeLockObject(http->entry);
            storeCreateMemObject(http->entry, http->uri);
-           http->entry->mem_obj->method = http->request->method;
+           urlMethodAssign(&http->entry->mem_obj->method, 
http->request->method);
            http->sc = storeClientRegister(http->entry, http);
            http->log_type = LOG_TCP_HIT;
            storeClientCopyHeaders(http->sc, http->entry,
=======================================
--- /branches/LUSCA_HEAD/src/store_vary.c       Sat Feb 13 23:34:59 2010
+++ /branches/LUSCA_HEAD/src/store_vary.c       Fri Apr  2 02:06:29 2010
@@ -355,7 +355,7 @@
        /* Swap in the dummy Vary object */
        if (!state->oe->mem_obj) {
            storeCreateMemObject(state->oe, state->url);
-           state->oe->mem_obj->method = method;
+           urlMethodAssign(&state->oe->mem_obj->method, method);
        }
        state->sc = storeClientRegister(state->oe, state);
        state->buf = memAllocBuf(4096, &state->buf_size);

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to