aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 16:53:04 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 16:53:04 +0000
commit5dd52de750ce5dfbbe182d204d0a66498bc69a9a (patch)
treecd6e2ed6e5212eb1658d9df3a007047123509e68 /src/libutil
parent7672a0ae2ef3ea7d6c79f1f9de5f3d9d1cd84b85 (diff)
downloadrspamd-5dd52de750ce5dfbbe182d204d0a66498bc69a9a.tar.gz
rspamd-5dd52de750ce5dfbbe182d204d0a66498bc69a9a.zip
[Fix] Fix invalid memory access on reload
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/map.c10
-rw-r--r--src/libutil/map_private.h3
2 files changed, 11 insertions, 2 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c
index 3794cfcfa..ea295e7a4 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -294,8 +294,9 @@ free_http_cbdata_dtor (gpointer p)
struct rspamd_map *map;
map = cbd->map;
+ cbd->stage = map_finished;
msg_warn_map ("connection with http server is terminated: worker is stopping");
- free_http_cbdata_common (cbd, FALSE);
+ REF_RELEASE (cbd);
}
/*
@@ -785,6 +786,11 @@ rspamd_map_dns_callback (struct rdns_reply *reply, void *arg)
map = cbd->map;
+ if (cbd->stage == map_finished) {
+ MAP_RELEASE (cbd, "http_callback_data");
+ return;
+ }
+
if (reply->code == RDNS_RC_NOERROR) {
/*
* We just get the first address hoping that a resolver performs
@@ -1346,6 +1352,8 @@ rspamd_map_is_map (const gchar *map_line)
static void
rspamd_map_backend_dtor (struct rspamd_map_backend *bk)
{
+ g_free (bk->uri);
+
if (bk->protocol == MAP_PROTO_FILE) {
if (bk->data.fd) {
g_free (bk->data.fd->filename);
diff --git a/src/libutil/map_private.h b/src/libutil/map_private.h
index 4879d5257..9e24695b5 100644
--- a/src/libutil/map_private.h
+++ b/src/libutil/map_private.h
@@ -116,7 +116,8 @@ enum rspamd_map_http_stage {
map_resolve_host1, /* 1 requests sent */
map_load_file,
map_load_pubkey,
- map_load_signature
+ map_load_signature,
+ map_finished
};
struct map_periodic_cbdata {