commit ceaafac: [Minor] Fix cleanup

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Feb 27 14:28:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-02-26 16:01:17 +0000
URL: https://github.com/rspamd/rspamd/commit/ceaafac997acb1cd58c4682f26de0be9dfe11da6

[Minor] Fix cleanup

---
 src/controller.c           | 2 +-
 src/fuzzy_storage.c        | 2 +-
 src/libutil/http_context.c | 8 ++++++++
 src/rspamd_proxy.c         | 2 +-
 src/worker.c               | 2 +-
 5 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/controller.c b/src/controller.c
index 350745f3c..87ac965ec 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -3942,8 +3942,8 @@ start_controller_worker (struct rspamd_worker *worker)
 
 	g_hash_table_unref (ctx->plugins);
 	g_hash_table_unref (ctx->custom_commands);
-	rspamd_http_context_free (ctx->http_ctx);
 	REF_RELEASE (ctx->cfg);
+	rspamd_http_context_free (ctx->http_ctx);
 	rspamd_log_close (worker->srv->logger, TRUE);
 
 	exit (EXIT_SUCCESS);
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 8dae4fb4b..50a99f030 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -3235,8 +3235,8 @@ start_fuzzy (struct rspamd_worker *worker)
 		rspamd_keypair_cache_destroy (ctx->keypair_cache);
 	}
 
-	rspamd_http_context_free (ctx->http_ctx);
 	REF_RELEASE (ctx->cfg);
+	rspamd_http_context_free (ctx->http_ctx);
 	rspamd_log_close (worker->srv->logger, TRUE);
 
 	exit (EXIT_SUCCESS);
diff --git a/src/libutil/http_context.c b/src/libutil/http_context.c
index 39a02b179..87540eee8 100644
--- a/src/libutil/http_context.c
+++ b/src/libutil/http_context.c
@@ -176,6 +176,14 @@ rspamd_http_context_free (struct rspamd_http_context *ctx)
 		rspamd_keypair_cache_destroy (ctx->server_kp_cache);
 	}
 
+	if (ctx->config.client_key_rotate_time > 0) {
+		event_del (&ctx->client_rotate_ev);
+
+		if (ctx->client_kp) {
+			rspamd_keypair_unref (ctx->client_kp);
+		}
+	}
+
 	g_free (ctx);
 }
 
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index e25a66caf..4add6cc22 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -2213,8 +2213,8 @@ start_rspamd_proxy (struct rspamd_worker *worker)
 		rspamd_stat_close ();
 	}
 
-	rspamd_http_context_free (ctx->http_ctx);
 	REF_RELEASE (ctx->cfg);
+	rspamd_http_context_free (ctx->http_ctx);
 	rspamd_log_close (worker->srv->logger, TRUE);
 
 	exit (EXIT_SUCCESS);
diff --git a/src/worker.c b/src/worker.c
index 0e993b84c..920ee7f72 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -703,8 +703,8 @@ start_worker (struct rspamd_worker *worker)
 	rspamd_worker_block_signals ();
 
 	rspamd_stat_close ();
-	rspamd_http_context_free (ctx->http_ctx);
 	REF_RELEASE (ctx->cfg);
+	rspamd_http_context_free (ctx->http_ctx);
 	rspamd_log_close (worker->srv->logger, TRUE);
 
 	exit (EXIT_SUCCESS);


More information about the Commits mailing list