current loaders.c,1.106,1.107

Fabian Keil via ijbswa-commits <[email protected]> Mon, 26 Jun 2017 12:17:46 +0000
Newsgroups gmane.comp.web.privoxy.cvs
Message-ID <[email protected]>
Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22103

Modified Files:
	loaders.c 
Log Message:
Factor free_csp_resources() out of sweep()

Sponsored by: Robert Klemme


Index: loaders.c
===================================================================
RCS file: /cvsroot/ijbswa/current/loaders.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -d -r1.106 -r1.107
*** loaders.c	24 Dec 2016 16:00:49 -0000	1.106
--- loaders.c	26 Jun 2017 12:17:43 -0000	1.107
***************
*** 84,87 ****
--- 84,123 ----
  };
  
+ /*********************************************************************
+  *
+  * Function    :  free_csp_resources
+  *
+  * Description :  Frees memory referenced by the csp that isn't
+  *                shared with other csps.
+  *
+  * Parameters  :
+  *          1  :  csp = Current client state (buffers, headers, etc...)
+  *
+  * Returns     :  N/A
+  *
+  *********************************************************************/
+ void free_csp_resources(struct client_state *csp)
+ {
+    freez(csp->ip_addr_str);
+ #ifdef FEATURE_CLIENT_TAGS
+    freez(csp->client_address);
+ #endif
+    freez(csp->listen_addr_str);
+    freez(csp->client_iob->buf);
+    freez(csp->iob->buf);
+    freez(csp->error_message);
+ 
+    if (csp->action->flags & ACTION_FORWARD_OVERRIDE &&
+       NULL != csp->fwd)
+    {
+       unload_forward_spec(csp->fwd);
+    }
+    free_http_request(csp->http);
+ 
+    destroy_list(csp->headers);
+    destroy_list(csp->tags);
+ 
+    free_current_action(csp->action);
+ }
  
  /*********************************************************************
***************
*** 184,207 ****
           last_active->next = client_list->next;
  
!          freez(csp->ip_addr_str);
! #ifdef FEATURE_CLIENT_TAGS
!          freez(csp->client_address);
! #endif
!          freez(csp->listen_addr_str);
!          freez(csp->client_iob->buf);
!          freez(csp->iob->buf);
!          freez(csp->error_message);
! 
!          if (csp->action->flags & ACTION_FORWARD_OVERRIDE &&
!              NULL != csp->fwd)
!          {
!             unload_forward_spec(csp->fwd);
!          }
!          free_http_request(csp->http);
! 
!          destroy_list(csp->headers);
!          destroy_list(csp->tags);
! 
!          free_current_action(csp->action);
  
  #ifdef FEATURE_STATISTICS
--- 220,224 ----
           last_active->next = client_list->next;
  
!          free_csp_resources(csp);
  
  #ifdef FEATURE_STATISTICS


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot