Revision: 14723
Author: adrian.chadd
Date: Thu Jul  8 00:22:01 2010
Log: Attempt to fix Issue #116 - free MemBuf which is potentially allocated
but not used.

From Squid-2.HEAD changeset 12696.


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

Modified:
 /branches/LUSCA_HEAD/src/HttpReply.c
 /branches/LUSCA_HEAD/src/client_side.c
 /branches/LUSCA_HEAD/src/store_vary.c

=======================================
--- /branches/LUSCA_HEAD/src/HttpReply.c        Wed Nov  4 20:51:30 2009
+++ /branches/LUSCA_HEAD/src/HttpReply.c        Thu Jul  8 00:22:01 2010
@@ -252,8 +252,10 @@
     httpHeaderPutTime(hdr, HDR_DATE, squid_curtime);
     if (ctype) {
        httpHeaderPutStr(hdr, HDR_CONTENT_TYPE, ctype);
+       /* XXX is this potentially overwriting an existing String? */
        stringInit(&reply->content_type, ctype);
     } else
+       /* XXX is this potentially overwriting an existing String? */
        reply->content_type = StringNull;
     if (clen >= 0)
        httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, clen);
@@ -373,8 +375,10 @@
     rep->last_modified = httpHeaderGetTime(hdr, HDR_LAST_MODIFIED);
     str = httpHeaderGetStr(hdr, HDR_CONTENT_TYPE);
     if (str)
+       /* XXX is this potentially overwriting an existing String? */
        stringLimitInit(&rep->content_type, str, strcspn(str, ";\t "));
     else
+       /* XXX is this potentially overwriting an existing String? */
        rep->content_type = StringNull;
     rep->cache_control = httpHeaderGetCc(hdr);
     rep->content_range = httpHeaderGetContRange(hdr);
=======================================
--- /branches/LUSCA_HEAD/src/client_side.c      Thu May 20 02:19:09 2010
+++ /branches/LUSCA_HEAD/src/client_side.c      Thu Jul  8 00:22:01 2010
@@ -1682,6 +1682,7 @@
     if (mb.size > 0) {
        comm_write_mbuf(http->conn->fd, mb, clientWriteComplete, http);
     } else {
+       memBufClean(&mb);
        storeClientRef(http->sc, http->entry,
            http->out.offset,
            http->out.offset,
=======================================
--- /branches/LUSCA_HEAD/src/store_vary.c       Fri Apr  2 02:06:29 2010
+++ /branches/LUSCA_HEAD/src/store_vary.c       Thu Jul  8 00:22:01 2010
@@ -585,10 +585,18 @@
     state->seen_offset = offset;
if (!strLen2(e->mem_obj->reply->content_type) || strCmp(e->mem_obj->reply->content_type, "x-squid-internal/vary") != 0) {
        /* This is not our Vary marker object. Bail out. */
- debug(33, 1) ("storeLocateVary: Not our vary marker object, %s = '%s', '%s'/'%.*s'\n", + debug(33, 1) ("storeLocateVary: Not our vary marker object, %s = '%s', vary_data='%s' ; accept_encoding='%.*s'\n",
            storeKeyText(e->hash.key), e->mem_obj->url, vary_data,
            strLen2(accept_encoding) ? strLen2(accept_encoding) : 1,
            strBuf2(accept_encoding) ? strBuf2(accept_encoding) : "-");
+
+       if (strLen2(e->mem_obj->reply->content_type))
+               debug(33, 1) ("storeLocateVary: local content type: '%.*s'\n",
+                   strLen2(e->mem_obj->reply->content_type),
+                   strBuf2(e->mem_obj->reply->content_type));
+       else
+ debug(33, 1) ("storeLocateVary: reply->content_type length is 0, why!?\n");
+
        storeLocateVaryCallback(state);
        return;
     }

--
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