From: Fabian Keil <fk@fabiankeil.de>
Date: Mon, 26 Jun 2017 12:17:57 +0000 (+0000)
Subject: Free csp resources in the thread that belongs to the csp
X-Git-Tag: v_3_0_27~102
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/faq/%22https:/developer-manual/static/@default-cgi@show-url-info?a=commitdiff_plain;h=8abd1cc33f1b39e5618ecc883024de0ef6aa9c09;p=privoxy.git

Free csp resources in the thread that belongs to the csp

... instead of the main thread which has enough on
its plate already.

Sponsored by: Robert Klemme
---

diff --git a/jcc.c b/jcc.c
index 3bb2801c..51cdbb94 100644
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.464 2017/06/26 12:13:52 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.465 2017/06/26 12:14:25 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -3386,6 +3386,8 @@ static void serve(struct client_state *csp)
       drain_and_close_socket(csp->cfd);
    }
 
+   free_csp_resources(csp);
+
    csp->flags &= ~CSP_FLAG_ACTIVE;
 
 }
diff --git a/loaders.c b/loaders.c
index af5a8d7e..16529e0f 100644
--- a/loaders.c
+++ b/loaders.c
@@ -1,4 +1,4 @@
-const char loaders_rcs[] = "$Id: loaders.c,v 1.106 2016/12/24 16:00:49 fabiankeil Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.107 2017/06/26 12:17:43 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.c,v $
@@ -219,8 +219,6 @@ unsigned int sweep(void)
       {
          last_active->next = client_list->next;
 
-         free_csp_resources(csp);
-
 #ifdef FEATURE_STATISTICS
          urls_read++;
          if (csp->flags & CSP_FLAG_REJECTED)
diff --git a/loaders.h b/loaders.h
index 54c4aa27..a2abec34 100644
--- a/loaders.h
+++ b/loaders.h
@@ -1,6 +1,6 @@
 #ifndef LOADERS_H_INCLUDED
 #define LOADERS_H_INCLUDED
-#define LOADERS_H_VERSION "$Id: loaders.h,v 1.32 2013/11/24 14:23:28 fabiankeil Exp $"
+#define LOADERS_H_VERSION "$Id: loaders.h,v 1.33 2016/12/24 16:00:49 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.h,v $
@@ -39,6 +39,7 @@
 
 
 extern unsigned int sweep(void);
+extern void free_csp_resources(struct client_state *csp);
 extern char *read_config_line(FILE *fp, unsigned long *linenum, char **buf);
 extern int check_file_changed(const struct file_list * current,
                               const char * filename,