-const char loaders_rcs[] = "$Id: loaders.c,v 1.104 2016/05/22 12:43:07 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
#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.
static struct file_list *current_trustfile = NULL;
#endif /* def FEATURE_TRUST */
+#ifndef FUZZ
static int load_one_re_filterfile(struct client_state *csp, int fileid);
+#endif
static struct file_list *current_re_filterfile[MAX_AF_FILES] = {
NULL, NULL, NULL, NULL, NULL,
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);
+}
/*********************************************************************
*
{
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)
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;
}
for (;;)
{
ch = getc(fp);
+
if (ch == EOF)
{
if (len > 0)
}
else if (ch == 0)
{
+ /* XXX: Why do we allow this anyway? */
*p = '\0';
*dest = buf;
return JB_ERR_OK;