X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=loaders.c;h=7683fa56efa71b96367d548f1bc0aebc101d011d;hp=135b2084a2ef6a60381684a5d7e93e3bd352d439;hb=ad45fb4e5bb7b48f422268cb20b37439d2ad8796;hpb=f67b3326138f428863c21c7738e0c8db87fa6f5c diff --git a/loaders.c b/loaders.c index 135b2084..7683fa56 100644 --- a/loaders.c +++ b/loaders.c @@ -1,4 +1,3 @@ -const char loaders_rcs[] = "$Id: loaders.c,v 1.105 2016/05/25 10:50:55 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loaders.c,v $ @@ -63,8 +62,6 @@ const char loaders_rcs[] = "$Id: loaders.c,v 1.105 2016/05/25 10:50:55 fabiankei #include "urlmatch.h" #include "encode.h" -const char loaders_h_rcs[] = LOADERS_H_VERSION; - /* * Currently active files. * These are also entered in the main linked list of files. @@ -83,6 +80,42 @@ static struct file_list *current_re_filterfile[MAX_AF_FILES] = { NULL, NULL, NULL, NULL, NULL }; +/********************************************************************* + * + * 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); +} /********************************************************************* * @@ -183,27 +216,6 @@ unsigned int sweep(void) { 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 urls_read++; if (csp->flags & CSP_FLAG_REJECTED) @@ -298,12 +310,6 @@ int check_file_changed(const struct file_list * current, fs->filename = strdup_or_die(filename); fs->lastmodified = statbuf->st_mtime; - if (fs->filename == NULL) - { - /* Out of memory error */ - freez (fs); - return 1; - } *newfl = fs; return 1; }