From: Vsevolod Stakhov Date: Tue, 17 Jan 2017 16:53:04 +0000 (+0000) Subject: [Fix] Fix invalid memory access on reload X-Git-Tag: 1.5.0~324 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5dd52de750ce5dfbbe182d204d0a66498bc69a9a;p=thirdparty%2Frspamd.git [Fix] Fix invalid memory access on reload --- diff --git a/src/libutil/map.c b/src/libutil/map.c index 3794cfcfaf..ea295e7a43 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 4879d5257c..9e24695b53 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 {