Revision: 14761
Author: adrian.chadd
Date: Tue Aug 24 01:23:27 2010
Log: Fix a memory leak in the errorState handling when connections are aborted.

The ErrorState entry may not have been valid when this function is called.
If it is valid, it is only used if the StoreEntry doesn't yet have any data
fed into it.

This patch ensures the ErrorState is freed, regardless of whether it's used
(and then implictly freed) or not.


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

Modified:
 /branches/LUSCA_HEAD/src/store.c

=======================================
--- /branches/LUSCA_HEAD/src/store.c    Fri Mar  5 18:36:15 2010
+++ /branches/LUSCA_HEAD/src/store.c    Tue Aug 24 01:23:27 2010
@@ -846,6 +846,7 @@
 }

 /* Aborted transfer into the local cache. */
+/* This takes ownership of ErrorState *err */
 void
 storeRequestFailed(StoreEntry * e, ErrorState * err)
 {
@@ -860,10 +861,13 @@
     if (e->mem_obj->inmem_hi == 0) {
        assert(err);
        errorAppendEntry(e, err);
+       err = NULL;
     } else {
        EBIT_SET(e->flags, ENTRY_ABORTED);
        EBIT_CLR(e->flags, ENTRY_FWD_HDR_WAIT);
     }
+    if (err)
+       errorStateFree(err);
     e->store_status = STORE_OK;
     mem->object_sz = mem->inmem_hi;
     /* Notify the client side */

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