summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/controller.c6
-rw-r--r--src/fuzzy_storage.c18
-rw-r--r--src/libmime/message.c2
-rw-r--r--src/libserver/milter.c2
-rw-r--r--src/libserver/monitored.c4
-rw-r--r--src/libserver/task.c4
-rw-r--r--src/libutil/addr.c16
-rw-r--r--src/libutil/addr.h2
-rw-r--r--src/libutil/map.c6
-rw-r--r--src/libutil/upstream.c4
-rw-r--r--src/lua/lua_dns.c4
-rw-r--r--src/lua/lua_http.c2
-rw-r--r--src/lua/lua_ip.c2
-rw-r--r--src/lua/lua_redis.c12
-rw-r--r--src/lua/lua_task.c2
-rw-r--r--src/lua/lua_tcp.c2
-rw-r--r--src/lua_worker.c2
-rw-r--r--src/rspamadm/control.c4
-rw-r--r--src/rspamd_proxy.c2
-rw-r--r--test/lua/unit/addr.lua4
-rw-r--r--test/rspamd_http_test.c2
21 files changed, 51 insertions, 51 deletions
diff --git a/src/controller.c b/src/controller.c
index 9b18a1945..ad24e5034 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -425,7 +425,7 @@ rspamd_controller_check_forwarded (struct rspamd_controller_session *session,
ret = -1;
}
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
}
else {
msg_warn_session ("cannot parse forwarded IP: %T", hdr);
@@ -455,7 +455,7 @@ rspamd_controller_check_forwarded (struct rspamd_controller_session *session,
ret = -1;
}
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
}
else {
msg_warn_session ("cannot parse real IP: %T", hdr);
@@ -2953,7 +2953,7 @@ rspamd_controller_finish_handler (struct rspamd_http_connection_entry *conn_ent)
}
session->wrk->nconns --;
- rspamd_inet_address_destroy (session->from_addr);
+ rspamd_inet_address_free (session->from_addr);
REF_RELEASE (session->cfg);
if (session->pool) {
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index b88090228..90f283b4a 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -1249,7 +1249,7 @@ fuzzy_session_destroy (gpointer d)
{
struct fuzzy_session *session = d;
- rspamd_inet_address_destroy (session->addr);
+ rspamd_inet_address_free (session->addr);
rspamd_explicit_memzero (session->nm, sizeof (session->nm));
session->worker->nconns--;
g_slice_free1 (sizeof (*session), session);
@@ -1261,7 +1261,7 @@ rspamd_fuzzy_mirror_session_destroy (struct fuzzy_master_update_session *session
if (session) {
rspamd_http_connection_reset (session->conn);
rspamd_http_connection_unref (session->conn);
- rspamd_inet_address_destroy (session->addr);
+ rspamd_inet_address_free (session->addr);
close (session->sock);
if (session->psrc) {
@@ -1406,7 +1406,7 @@ rspamd_fuzzy_collection_finish_handler (struct rspamd_http_connection_entry *con
struct rspamd_fuzzy_collection_session *session = conn_ent->ud;
- rspamd_inet_address_destroy (session->from_addr);
+ rspamd_inet_address_free (session->from_addr);
g_slice_free1 (sizeof (struct rspamd_fuzzy_collection_session), session);
@@ -1621,7 +1621,7 @@ accept_fuzzy_collection_socket (gint fd, short what, void *arg)
if (!ctx->collection_keypair) {
msg_err ("deny request from %s, as no local keypair is specified",
rspamd_inet_address_to_string (addr));
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
close (nfd);
return;
@@ -1709,7 +1709,7 @@ accept_fuzzy_mirror_socket (gint fd, short what, void *arg)
if (!ctx->master_ips) {
msg_err ("deny update request from %s as no masters defined",
rspamd_inet_address_to_string (addr));
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
close (nfd);
return;
@@ -1717,7 +1717,7 @@ accept_fuzzy_mirror_socket (gint fd, short what, void *arg)
else if (radix_find_compressed_addr (ctx->master_ips, addr) == RADIX_NO_VALUE) {
msg_err ("deny update request from %s",
rspamd_inet_address_to_string (addr));
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
close (nfd);
return;
@@ -1726,7 +1726,7 @@ accept_fuzzy_mirror_socket (gint fd, short what, void *arg)
if (!ctx->sync_keypair) {
msg_err ("deny update request from %s, as no local keypair is specified",
rspamd_inet_address_to_string (addr));
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
close (nfd);
return;
@@ -2309,7 +2309,7 @@ fuzzy_parse_keypair (rspamd_mempool_t *pool,
keystat = rspamd_mempool_alloc0 (pool, sizeof (*keystat));
/* Hash of ip -> fuzzy_key_stat */
keystat->last_ips = rspamd_lru_hash_new_full (1024,
- (GDestroyNotify)rspamd_inet_address_destroy, fuzzy_key_stat_dtor,
+ (GDestroyNotify) rspamd_inet_address_free, fuzzy_key_stat_dtor,
rspamd_inet_address_hash, rspamd_inet_address_equal);
key->stat = keystat;
pk = rspamd_keypair_component (kp, RSPAMD_KEYPAIR_COMPONENT_PK,
@@ -2366,7 +2366,7 @@ init_fuzzy (struct rspamd_config *cfg)
rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t)g_hash_table_unref, ctx->master_flags);
ctx->errors_ips = rspamd_lru_hash_new_full (1024,
- (GDestroyNotify) rspamd_inet_address_destroy, g_free,
+ (GDestroyNotify) rspamd_inet_address_free, g_free,
rspamd_inet_address_hash, rspamd_inet_address_equal);
rspamd_mempool_add_destructor (cfg->cfg_pool,
(rspamd_mempool_destruct_t)rspamd_lru_hash_destroy, ctx->errors_ips);
diff --git a/src/libmime/message.c b/src/libmime/message.c
index c1e3ff580..326db2038 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -777,7 +777,7 @@ rspamd_message_parse (struct rspamd_task *task)
trecv->from_ip = trecv->real_ip;
trecv->addr = rspamd_inet_address_copy (task->from_addr);
rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t)rspamd_inet_address_destroy,
+ (rspamd_mempool_destruct_t)rspamd_inet_address_free,
trecv->addr);
if (task->hostname) {
diff --git a/src/libserver/milter.c b/src/libserver/milter.c
index 20bd4ba98..5cc92c22a 100644
--- a/src/libserver/milter.c
+++ b/src/libserver/milter.c
@@ -91,7 +91,7 @@ rspamd_milter_session_dtor (struct rspamd_milter_session *session)
}
if (session->addr) {
- rspamd_inet_address_destroy (session->addr);
+ rspamd_inet_address_free (session->addr);
}
if (session->rcpts) {
diff --git a/src/libserver/monitored.c b/src/libserver/monitored.c
index a7b3fb37d..09d642d09 100644
--- a/src/libserver/monitored.c
+++ b/src/libserver/monitored.c
@@ -285,11 +285,11 @@ rspamd_monitored_dns_cb (struct rdns_reply *reply, void *arg)
rspamd_monitored_propagate_error (m,
"invalid address");
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
}
else {
rspamd_monitored_propagate_success (m, lat);
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
}
}
}
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 4a8b35b9c..032e6caba 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -255,11 +255,11 @@ rspamd_task_free (struct rspamd_task *task)
}
if (task->client_addr) {
- rspamd_inet_address_destroy (task->client_addr);
+ rspamd_inet_address_free (task->client_addr);
}
if (task->from_addr) {
- rspamd_inet_address_destroy (task->from_addr);
+ rspamd_inet_address_free (task->from_addr);
}
if (task->err) {
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index fb4c537c4..5ef5c9dc0 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -126,7 +126,7 @@ rspamd_inet_addr_create (gint af)
}
void
-rspamd_inet_address_destroy (rspamd_inet_addr_t *addr)
+rspamd_inet_address_free (rspamd_inet_addr_t *addr)
{
if (addr) {
if (addr->af == AF_UNIX) {
@@ -293,7 +293,7 @@ rspamd_accept_from_socket (gint sock, rspamd_inet_addr_t **target,
}
else {
/* Avoid leak */
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
}
return (nfd);
@@ -302,7 +302,7 @@ out:
serrno = errno;
close (nfd);
errno = serrno;
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
return (-1);
@@ -390,14 +390,14 @@ rspamd_parse_unix_path (rspamd_inet_addr_t **target, const char *src)
*target = addr;
}
else {
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
}
return TRUE;
err:
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
return FALSE;
}
@@ -1160,7 +1160,7 @@ rspamd_resolve_addrs (const char *begin, size_t len, GPtrArray **addrs,
if (rspamd_parse_inet_address (&cur_addr, begin, len)) {
if (*addrs == NULL) {
*addrs = g_ptr_array_new_full (1,
- (GDestroyNotify)rspamd_inet_address_destroy);
+ (GDestroyNotify) rspamd_inet_address_free);
if (pool != NULL) {
rspamd_mempool_add_destructor (pool,
@@ -1206,7 +1206,7 @@ rspamd_resolve_addrs (const char *begin, size_t len, GPtrArray **addrs,
if (*addrs == NULL) {
*addrs = g_ptr_array_new_full (addr_cnt,
- (GDestroyNotify)rspamd_inet_address_destroy);
+ (GDestroyNotify) rspamd_inet_address_free);
if (pool != NULL) {
rspamd_mempool_add_destructor (pool,
@@ -1310,7 +1310,7 @@ rspamd_parse_host_port_priority (const gchar *str,
/* Special case of unix socket, as getaddrinfo cannot deal with them */
if (*addrs == NULL) {
*addrs = g_ptr_array_new_full (1,
- (GDestroyNotify)rspamd_inet_address_destroy);
+ (GDestroyNotify) rspamd_inet_address_free);
if (pool != NULL) {
rspamd_mempool_add_destructor (pool,
diff --git a/src/libutil/addr.h b/src/libutil/addr.h
index a50786adc..9b0921747 100644
--- a/src/libutil/addr.h
+++ b/src/libutil/addr.h
@@ -227,7 +227,7 @@ gboolean rspamd_parse_host_port_priority (const gchar *str,
* Destroy the specified IP address
* @param addr
*/
-void rspamd_inet_address_destroy (rspamd_inet_addr_t *addr);
+void rspamd_inet_address_free (rspamd_inet_addr_t *addr);
/**
* Apply the specified mask to an address (ignored for AF_UNIX)
diff --git a/src/libutil/map.c b/src/libutil/map.c
index 3c8db183b..30617689c 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -268,7 +268,7 @@ free_http_cbdata_common (struct http_callback_data *cbd, gboolean plan_new)
}
if (cbd->addr) {
- rspamd_inet_address_destroy (cbd->addr);
+ rspamd_inet_address_free (cbd->addr);
}
@@ -910,7 +910,7 @@ rspamd_map_dns_callback (struct rdns_reply *reply, void *arg)
write_http_request (cbd);
}
else {
- rspamd_inet_address_destroy (cbd->addr);
+ rspamd_inet_address_free (cbd->addr);
cbd->addr = NULL;
}
}
@@ -1094,7 +1094,7 @@ rspamd_map_common_http_callback (struct rspamd_map *map, struct rspamd_map_backe
else {
msg_warn_map ("cannot load map: cannot connect to %s: %s",
data->host, strerror (errno));
- rspamd_inet_address_destroy (cbd->addr);
+ rspamd_inet_address_free (cbd->addr);
cbd->addr = NULL;
MAP_RELEASE (cbd, "http_callback_data");
}
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 67debb017..529d3fcf0 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -226,7 +226,7 @@ rspamd_upstream_addr_elt_dtor (gpointer a)
{
struct upstream_addr_elt *elt = a;
- rspamd_inet_address_destroy (elt->addr);
+ rspamd_inet_address_free (elt->addr);
g_slice_free1 (sizeof (*elt), elt);
}
@@ -497,7 +497,7 @@ rspamd_upstream_dtor (struct upstream *up)
if (up->new_addrs) {
LL_FOREACH_SAFE(up->new_addrs, cur, tmp) {
/* Here we need to free pointer as well */
- rspamd_inet_address_destroy (cur->addr);
+ rspamd_inet_address_free (cur->addr);
g_free (cur);
}
}
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index 591147417..cc709ddaf 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -163,13 +163,13 @@ lua_dns_callback (struct rdns_reply *reply, gpointer arg)
case RDNS_REQUEST_A:
addr = rspamd_inet_address_new (AF_INET, &elt->content.a.addr);
rspamd_lua_ip_push (cd->L, addr);
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
lua_rawseti (cd->L, -2, ++i);
break;
case RDNS_REQUEST_AAAA:
addr = rspamd_inet_address_new (AF_INET6, &elt->content.aaa.addr);
rspamd_lua_ip_push (cd->L, addr);
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
lua_rawseti (cd->L, -2, ++i);
break;
case RDNS_REQUEST_NS:
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index 1cc10f48e..dd208f6d3 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -109,7 +109,7 @@ lua_http_fin (gpointer arg)
}
if (cbd->addr) {
- rspamd_inet_address_destroy (cbd->addr);
+ rspamd_inet_address_free (cbd->addr);
}
if (cbd->mime_type) {
diff --git a/src/lua/lua_ip.c b/src/lua/lua_ip.c
index 6499a657d..a604685aa 100644
--- a/src/lua/lua_ip.c
+++ b/src/lua/lua_ip.c
@@ -404,7 +404,7 @@ lua_ip_destroy (lua_State *L)
if (ip) {
if (ip->addr) {
- rspamd_inet_address_destroy (ip->addr);
+ rspamd_inet_address_free (ip->addr);
}
g_slice_free1 (sizeof (struct rspamd_lua_ip), ip);
}
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index ea9e5ba0e..7c568066f 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -707,7 +707,7 @@ rspamd_lua_redis_prepare_connection (lua_State *L, gint *pcbref)
rspamd_inet_address_get_port (addr->addr));
if (ip) {
- rspamd_inet_address_destroy (ip);
+ rspamd_inet_address_free (ip);
}
if (ud->ctx == NULL || ud->ctx->err) {
@@ -731,7 +731,7 @@ rspamd_lua_redis_prepare_connection (lua_State *L, gint *pcbref)
}
if (ip) {
- rspamd_inet_address_destroy (ip);
+ rspamd_inet_address_free (ip);
}
return NULL;
@@ -931,7 +931,7 @@ lua_redis_make_request_sync (lua_State *L)
rspamd_inet_address_get_port (addr->addr), tv);
if (ip) {
- rspamd_inet_address_destroy (ip);
+ rspamd_inet_address_free (ip);
}
if (ctx == NULL || ctx->err) {
@@ -972,7 +972,7 @@ lua_redis_make_request_sync (lua_State *L)
}
else {
if (ip) {
- rspamd_inet_address_destroy (ip);
+ rspamd_inet_address_free (ip);
}
msg_err ("bad arguments for redis request");
lua_pushboolean (L, FALSE);
@@ -1091,7 +1091,7 @@ lua_redis_connect_sync (lua_State *L)
rspamd_inet_address_get_port (addr->addr), tv);
if (ip) {
- rspamd_inet_address_destroy (ip);
+ rspamd_inet_address_free (ip);
}
if (ctx->d.sync == NULL || ctx->d.sync->err) {
@@ -1116,7 +1116,7 @@ lua_redis_connect_sync (lua_State *L)
}
else {
if (ip) {
- rspamd_inet_address_destroy (ip);
+ rspamd_inet_address_free (ip);
}
lua_pushboolean (L, FALSE);
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 01ca936dc..4ca66bbb4 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2587,7 +2587,7 @@ lua_task_set_from_ip (lua_State *L)
}
else {
if (task->from_addr) {
- rspamd_inet_address_destroy (task->from_addr);
+ rspamd_inet_address_free (task->from_addr);
}
task->from_addr = addr;
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c
index ed8330e81..c0938d684 100644
--- a/src/lua/lua_tcp.c
+++ b/src/lua/lua_tcp.c
@@ -281,7 +281,7 @@ lua_tcp_fin (gpointer arg)
}
if (cbd->addr) {
- rspamd_inet_address_destroy (cbd->addr);
+ rspamd_inet_address_free (cbd->addr);
}
while (lua_tcp_shift_handler (cbd)) {}
diff --git a/src/lua_worker.c b/src/lua_worker.c
index bd0a53a81..484f79722 100644
--- a/src/lua_worker.c
+++ b/src/lua_worker.c
@@ -289,7 +289,7 @@ lua_accept_socket (gint fd, short what, void *arg)
lua_pop (L, 1);
}
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
close (nfd);
}
diff --git a/src/rspamadm/control.c b/src/rspamadm/control.c
index afe10663c..12356169c 100644
--- a/src/rspamadm/control.c
+++ b/src/rspamadm/control.c
@@ -227,7 +227,7 @@ rspamadm_control (gint argc, gchar **argv)
if (sock == -1) {
rspamd_fprintf (stderr, "cannot connect to: %s\n", control_path);
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
exit (1);
}
@@ -255,7 +255,7 @@ rspamadm_control (gint argc, gchar **argv)
event_base_loop (ev_base, 0);
rspamd_http_connection_unref (conn);
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
lua_close (L);
close (sock);
}
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 97215d7c4..992a4f08d 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -848,7 +848,7 @@ proxy_session_dtor (struct rspamd_proxy_session *session)
g_ptr_array_free (session->mirror_conns, TRUE);
rspamd_http_message_shmem_unref (session->shmem_ref);
rspamd_http_message_unref (session->client_message);
- rspamd_inet_address_destroy (session->client_addr);
+ rspamd_inet_address_free (session->client_addr);
close (session->client_sock);
rspamd_mempool_delete (session->pool);
g_slice_free1 (sizeof (*session), session);
diff --git a/test/lua/unit/addr.lua b/test/lua/unit/addr.lua
index 519be358c..8229535ac 100644
--- a/test/lua/unit/addr.lua
+++ b/test/lua/unit/addr.lua
@@ -7,7 +7,7 @@ context("Inet addr check functions", function()
typedef struct rspamd_inet_addr_s rspamd_inet_addr_t;
bool rspamd_parse_inet_address (rspamd_inet_addr_t **target,
const char *src);
- void rspamd_inet_address_destroy (rspamd_inet_addr_t *addr);
+ void rspamd_inet_address_freefree (rspamd_inet_addr_t *addr);
]]
test("Create inet addr from string", function()
@@ -24,7 +24,7 @@ context("Inet addr check functions", function()
local res = ffi.C.rspamd_parse_inet_address(ip, c[1])
assert_equal(res, c[2], "Expect " .. tostring(c[2]) .. " while parsing " .. c[1])
if res then
- ffi.C.rspamd_inet_address_destroy(ip[0])
+ ffi.C.rspamd_inet_address_free(ip[0])
end
end
end)
diff --git a/test/rspamd_http_test.c b/test/rspamd_http_test.c
index 4ce859efd..19ee50ea1 100644
--- a/test/rspamd_http_test.c
+++ b/test/rspamd_http_test.c
@@ -65,7 +65,7 @@ rspamd_server_accept (gint fd, short what, void *arg)
return;
}
- rspamd_inet_address_destroy (addr);
+ rspamd_inet_address_free (addr);
rspamd_http_router_handle_socket (rt, nfd, NULL);
}