aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 15:14:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 15:14:33 +0100
commitb2b9cfa6161a98d5d4d074573f99fdac6cb24556 (patch)
tree7d531529f1798da141faeb17b0df1b47fc08896a /src
parent4656f5525d110e3951672ad66a29cfb395f7d32f (diff)
downloadrspamd-b2b9cfa6161a98d5d4d074573f99fdac6cb24556.tar.gz
rspamd-b2b9cfa6161a98d5d4d074573f99fdac6cb24556.zip
[Minor] Further portion of g_slice elimination
Diffstat (limited to 'src')
-rw-r--r--src/libmime/archives.c11
-rw-r--r--src/libmime/email_addr.c6
-rw-r--r--src/libmime/images.c4
-rw-r--r--src/libmime/mime_parser.c6
-rw-r--r--src/libserver/re_cache.c32
-rw-r--r--src/libserver/spf.c22
-rw-r--r--src/libserver/symbols_cache.c16
-rw-r--r--src/libstat/backends/redis_backend.c12
-rw-r--r--src/libstat/stat_config.c22
-rw-r--r--src/libutil/addr.c10
-rw-r--r--src/libutil/aio_event.c6
-rw-r--r--src/libutil/expression.c4
-rw-r--r--src/libutil/fstring.c4
-rw-r--r--src/libutil/hash.c4
-rw-r--r--src/libutil/heap.c4
-rw-r--r--src/libutil/http.c50
-rw-r--r--src/libutil/logger.c2
-rw-r--r--src/libutil/map.c34
-rw-r--r--src/libutil/multipattern.c8
-rw-r--r--src/libutil/radix.c4
-rw-r--r--src/libutil/ssl_util.c4
-rw-r--r--src/lua/lua_common.c4
-rw-r--r--src/lua/lua_config.c8
-rw-r--r--src/lua/lua_cryptobox.c8
-rw-r--r--src/lua/lua_fann.c10
-rw-r--r--src/lua/lua_http.c4
-rw-r--r--src/lua/lua_ip.c10
-rw-r--r--src/lua/lua_util.c4
-rw-r--r--src/plugins/surbl.c6
29 files changed, 160 insertions, 159 deletions
diff --git a/src/libmime/archives.c b/src/libmime/archives.c
index 28e898bee..6497f6b35 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -35,7 +35,8 @@ rspamd_archive_dtor (gpointer p)
if (f->fname) {
g_string_free (f->fname, TRUE);
}
- g_slice_free1 (sizeof (*f), f);
+
+ g_free (f);
}
g_ptr_array_free (arch->files, TRUE);
@@ -145,7 +146,7 @@ rspamd_archive_process_zip (struct rspamd_task *task,
return;
}
- f = g_slice_alloc0 (sizeof (*f));
+ f = g_malloc0 (sizeof (*f));
f->fname = g_string_new_len (cd + cd_basic_len, fname_len);
f->compressed_size = comp_size;
f->uncompressed_size = uncomp_size;
@@ -339,7 +340,7 @@ rspamd_archive_process_rar_v4 (struct rspamd_task *task, const guchar *start,
uncomp_sz += tmp;
}
- f = g_slice_alloc0 (sizeof (*f));
+ f = g_malloc0 (sizeof (*f));
if (flags & 0x200) {
/* We have unicode + normal version */
@@ -540,7 +541,7 @@ rspamd_archive_process_rar (struct rspamd_task *task,
return;
}
- f = g_slice_alloc0 (sizeof (*f));
+ f = g_malloc0 (sizeof (*f));
f->uncompressed_size = uncomp_sz;
f->compressed_size = comp_sz;
f->fname = g_string_new_len (p, fname_len);
@@ -1318,7 +1319,7 @@ rspamd_7zip_read_files_info (struct rspamd_task *task,
res = rspamd_7zip_ucs2_to_utf8 (task, p, fend);
if (res != NULL) {
- fentry = g_slice_alloc0 (sizeof (fentry));
+ fentry = g_malloc0 (sizeof (fentry));
fentry->fname = res;
g_ptr_array_add (arch->files, fentry);
}
diff --git a/src/libmime/email_addr.c b/src/libmime/email_addr.c
index 59e99f531..9e69b68ec 100644
--- a/src/libmime/email_addr.c
+++ b/src/libmime/email_addr.c
@@ -31,7 +31,7 @@ rspamd_email_addr_dtor (struct rspamd_email_address *addr)
g_free ((void *)addr->user);
}
- g_slice_free1 (sizeof (*addr), addr);
+ g_free (addr);
}
static void
@@ -74,7 +74,7 @@ rspamd_email_address_from_smtp (const gchar *str, guint len)
rspamd_smtp_addr_parse (str, len, &addr);
if (addr.flags & RSPAMD_EMAIL_ADDR_VALID) {
- ret = g_slice_alloc (sizeof (*ret));
+ ret = g_malloc (sizeof (*ret));
memcpy (ret, &addr, sizeof (addr));
if ((ret->flags & RSPAMD_EMAIL_ADDR_QUOTED) && ret->addr[0] == '"') {
@@ -123,7 +123,7 @@ rspamd_email_address_add (rspamd_mempool_t *pool,
struct rspamd_email_address *elt;
guint nlen;
- elt = g_slice_alloc0 (sizeof (*elt));
+ elt = g_malloc0 (sizeof (*elt));
if (addr != NULL) {
memcpy (elt, addr, sizeof (*addr));
diff --git a/src/libmime/images.c b/src/libmime/images.c
index 924264825..194f6e4e8 100644
--- a/src/libmime/images.c
+++ b/src/libmime/images.c
@@ -355,7 +355,7 @@ static void
rspamd_image_cache_entry_dtor (gpointer p)
{
struct rspamd_image_cache_entry *entry = p;
- g_slice_free1 (sizeof (*entry), entry);
+ g_free (entry);
}
static guint32
@@ -416,7 +416,7 @@ rspamd_image_save_hash (struct rspamd_task *task, struct rspamd_image *img)
task->tv.tv_sec);
if (!found) {
- found = g_slice_alloc0 (sizeof (*found));
+ found = g_malloc0 (sizeof (*found));
memcpy (found->dct, img->dct, RSPAMD_DCT_LEN / NBBY);
memcpy (found->digest, img->parent->digest, sizeof (found->digest));
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index f1bb26862..410e14fbb 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -1018,7 +1018,7 @@ rspamd_mime_parse_stack_free (struct rspamd_mime_parser_ctx *st)
if (st) {
g_ptr_array_free (st->stack, TRUE);
g_array_free (st->boundaries, TRUE);
- g_slice_free1 (sizeof (*st), st);
+ g_free (st);
}
}
@@ -1147,7 +1147,7 @@ rspamd_mime_parse_message (struct rspamd_task *task,
* Here are dragons:
* We allocate new parser context as we need to shift pointers
*/
- nst = g_slice_alloc0 (sizeof (*st));
+ nst = g_malloc0 (sizeof (*st));
nst->stack = g_ptr_array_sized_new (4);
nst->pos = task->raw_headers_content.body_start;
nst->end = task->msg.begin + task->msg.len;
@@ -1270,7 +1270,7 @@ rspamd_mime_parse_task (struct rspamd_task *task, GError **err)
lib_ctx->key_usages = 0;
}
- st = g_slice_alloc0 (sizeof (*st));
+ st = g_malloc0 (sizeof (*st));
st->stack = g_ptr_array_sized_new (4);
st->pos = task->raw_headers_content.body_start;
st->end = task->msg.begin + task->msg.len;
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index 760b2a440..e74de4e73 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -156,7 +156,7 @@ rspamd_re_cache_destroy (struct rspamd_re_cache *cache)
g_hash_table_unref (re_class->re);
if (re_class->type_data) {
- g_slice_free1 (re_class->type_len, re_class->type_data);
+ g_free (re_class->type_data);
}
#ifdef WITH_HYPERSCAN
@@ -170,12 +170,12 @@ rspamd_re_cache_destroy (struct rspamd_re_cache *cache)
g_free (re_class->hs_ids);
}
#endif
- g_slice_free1 (sizeof (*re_class), re_class);
+ g_free (re_class);
}
g_hash_table_unref (cache->re_classes);
g_ptr_array_free (cache->re, TRUE);
- g_slice_free1 (sizeof (*cache), cache);
+ g_free (cache);
}
static void
@@ -184,7 +184,7 @@ rspamd_re_cache_elt_dtor (gpointer e)
struct rspamd_re_cache_elt *elt = e;
rspamd_regexp_unref (elt->re);
- g_slice_free1 (sizeof (*elt), elt);
+ g_free (elt);
}
struct rspamd_re_cache *
@@ -192,7 +192,7 @@ rspamd_re_cache_new (void)
{
struct rspamd_re_cache *cache;
- cache = g_slice_alloc0 (sizeof (*cache));
+ cache = g_malloc0 (sizeof (*cache));
cache->re_classes = g_hash_table_new (g_int64_hash, g_int64_equal);
cache->nre = 0;
cache->re = g_ptr_array_new_full (256, rspamd_re_cache_elt_dtor);
@@ -232,7 +232,7 @@ rspamd_re_cache_add (struct rspamd_re_cache *cache, rspamd_regexp_t *re,
re_class = g_hash_table_lookup (cache->re_classes, &class_id);
if (re_class == NULL) {
- re_class = g_slice_alloc0 (sizeof (*re_class));
+ re_class = g_malloc0 (sizeof (*re_class));
re_class->id = class_id;
re_class->type_len = datalen;
re_class->type = type;
@@ -240,7 +240,7 @@ rspamd_re_cache_add (struct rspamd_re_cache *cache, rspamd_regexp_t *re,
rspamd_regexp_equal, NULL, (GDestroyNotify)rspamd_regexp_unref);
if (datalen > 0) {
- re_class->type_data = g_slice_alloc (datalen);
+ re_class->type_data = g_malloc0 (datalen);
memcpy (re_class->type_data, type_data, datalen);
}
@@ -252,7 +252,7 @@ rspamd_re_cache_add (struct rspamd_re_cache *cache, rspamd_regexp_t *re,
/*
* We set re id based on the global position in the cache
*/
- elt = g_slice_alloc0 (sizeof (*elt));
+ elt = g_malloc0 (sizeof (*elt));
/* One ref for re_class */
nre = rspamd_regexp_ref (re);
rspamd_regexp_set_cache_id (re, cache->nre++);
@@ -343,7 +343,7 @@ rspamd_re_cache_init (struct rspamd_re_cache *cache, struct rspamd_config *cfg)
rspamd_regexp_set_cache_id (re, i);
if (re_class->st == NULL) {
- re_class->st = g_slice_alloc (sizeof (*re_class->st));
+ re_class->st = g_malloc (sizeof (*re_class->st));
rspamd_cryptobox_hash_init (re_class->st, NULL, 0);
}
@@ -405,7 +405,7 @@ rspamd_re_cache_init (struct rspamd_re_cache *cache, struct rspamd_config *cfg)
rspamd_cryptobox_hash_final (re_class->st, hash_out);
rspamd_snprintf (re_class->hash, sizeof (re_class->hash), "%*xs",
(gint) rspamd_cryptobox_HASHBYTES, hash_out);
- g_slice_free1 (sizeof (*re_class->st), re_class->st);
+ g_free (re_class->st);
re_class->st = NULL;
}
}
@@ -456,11 +456,11 @@ rspamd_re_cache_runtime_new (struct rspamd_re_cache *cache)
struct rspamd_re_runtime *rt;
g_assert (cache != NULL);
- rt = g_slice_alloc0 (sizeof (*rt));
+ rt = g_malloc0 (sizeof (*rt));
rt->cache = cache;
REF_RETAIN (cache);
- rt->checked = g_slice_alloc0 (NBYTES (cache->nre));
- rt->results = g_slice_alloc0 (cache->nre);
+ rt->checked = g_malloc0 (NBYTES (cache->nre));
+ rt->results = g_malloc0 (cache->nre);
rt->stat.regexp_total = cache->nre;
#ifdef WITH_HYPERSCAN
rt->has_hs = cache->hyperscan_loaded;
@@ -1135,10 +1135,10 @@ rspamd_re_cache_runtime_destroy (struct rspamd_re_runtime *rt)
{
g_assert (rt != NULL);
- g_slice_free1 (NBYTES (rt->cache->nre), rt->checked);
- g_slice_free1 (rt->cache->nre, rt->results);
+ g_free (rt->checked);
+ g_free (rt->results);
REF_RELEASE (rt->cache);
- g_slice_free1 (sizeof (*rt), rt);
+ g_free (rt);
}
void
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index edce244b9..45530b6e8 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -193,7 +193,7 @@ rspamd_spf_new_addr (struct spf_record *rec,
gboolean need_shift = FALSE;
struct spf_addr *naddr;
- naddr = g_slice_alloc0 (sizeof (*naddr));
+ naddr = g_malloc0 (sizeof (*naddr));
naddr->mech = check_spf_mech (elt, &need_shift);
if (need_shift) {
@@ -218,7 +218,7 @@ rspamd_spf_free_addr (gpointer a)
if (addr) {
g_free (addr->spf_string);
DL_FOREACH_SAFE (addr, cur, tmp) {
- g_slice_free1 (sizeof (*cur), cur);
+ g_free (cur);
}
}
}
@@ -228,7 +228,7 @@ rspamd_spf_new_addr_list (struct spf_record *rec, const gchar *domain)
{
struct spf_resolved_element *resolved;
- resolved = g_slice_alloc (sizeof (*resolved));
+ resolved = g_malloc0 (sizeof (*resolved));
resolved->redirected = FALSE;
resolved->cur_domain = g_strdup (domain);
resolved->elts = g_ptr_array_new_full (8, rspamd_spf_free_addr);
@@ -253,7 +253,7 @@ spf_record_destructor (gpointer r)
elt = g_ptr_array_index (rec->resolved, i);
g_ptr_array_free (elt->elts, TRUE);
g_free (elt->cur_domain);
- g_slice_free1 (sizeof (*elt), elt);
+ g_free (elt);
}
g_ptr_array_free (rec->resolved, TRUE);
@@ -273,7 +273,7 @@ rspamd_flatten_record_dtor (struct spf_resolved *r)
g_free (r->domain);
g_array_free (r->elts, TRUE);
- g_slice_free1 (sizeof (*r), r);
+ g_free (r);
}
static void
@@ -384,7 +384,7 @@ rspamd_spf_record_flatten (struct spf_record *rec)
g_assert (rec != NULL);
if (rec->resolved) {
- res = g_slice_alloc0 (sizeof (*res));
+ res = g_malloc0 (sizeof (*res));
res->elts = g_array_sized_new (FALSE, FALSE, sizeof (struct spf_addr),
rec->resolved->len);
res->domain = g_strdup (rec->sender_domain);
@@ -396,7 +396,7 @@ rspamd_spf_record_flatten (struct spf_record *rec)
}
}
else {
- res = g_slice_alloc0 (sizeof (*res));
+ res = g_malloc0 (sizeof (*res));
res->elts = g_array_new (FALSE, FALSE, sizeof (struct spf_addr));
res->domain = g_strdup (rec->sender_domain);
res->ttl = rec->ttl;
@@ -511,7 +511,7 @@ spf_record_process_addr (struct spf_record *rec, struct spf_addr *addr, struct
}
else {
/* We need to create a new address */
- naddr = g_slice_alloc0 (sizeof (*naddr));
+ naddr = g_malloc0 (sizeof (*naddr));
memcpy (naddr, addr, sizeof (*naddr));
naddr->next = NULL;
naddr->prev = NULL;
@@ -2005,7 +2005,7 @@ spf_dns_callback (struct rdns_reply *reply, gpointer arg)
else if ((reply->code == RDNS_RC_NOREC || reply->code == RDNS_RC_NXDOMAIN)
&& rec->dns_requests == 0) {
resolved = rspamd_spf_new_addr_list (rec, rec->sender_domain);
- addr = g_slice_alloc0 (sizeof(*addr));
+ addr = g_malloc0 (sizeof(*addr));
addr->flags = 0;
addr->flags |= RSPAMD_SPF_FLAG_NA;
g_ptr_array_insert (resolved->elts, 0, addr);
@@ -2013,7 +2013,7 @@ spf_dns_callback (struct rdns_reply *reply, gpointer arg)
else if (reply->code != RDNS_RC_NOREC && reply->code != RDNS_RC_NXDOMAIN
&& rec->dns_requests == 0) {
resolved = rspamd_spf_new_addr_list (rec, rec->sender_domain);
- addr = g_slice_alloc0 (sizeof(*addr));
+ addr = g_malloc0 (sizeof(*addr));
addr->flags = 0;
addr->flags |= RSPAMD_SPF_FLAG_TEMPFAIL;
g_ptr_array_insert (resolved->elts, 0, addr);
@@ -2032,7 +2032,7 @@ spf_dns_callback (struct rdns_reply *reply, gpointer arg)
}
}
else {
- addr = g_slice_alloc0 (sizeof(*addr));
+ addr = g_malloc0 (sizeof(*addr));
addr->flags = 0;
if (reply->code == RDNS_RC_NOREC || reply->code == RDNS_RC_NXDOMAIN
|| reply->code == RDNS_RC_NOERROR) {
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index 7a9e05d27..4cf1cab5b 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -216,7 +216,7 @@ rspamd_symbols_cache_order_dtor (gpointer p)
struct symbols_cache_order *ord = p;
g_ptr_array_free (ord->d, TRUE);
- g_slice_free1 (sizeof (*ord), ord);
+ g_free (ord);
}
static void
@@ -232,7 +232,7 @@ rspamd_symbols_cache_order_new (gsize nelts)
{
struct symbols_cache_order *ord;
- ord = g_slice_alloc (sizeof (*ord));
+ ord = g_malloc0 (sizeof (*ord));
ord->d = g_ptr_array_sized_new (nelts);
REF_INIT_RETAIN (ord, rspamd_symbols_cache_order_dtor);
@@ -880,7 +880,7 @@ rspamd_symbols_cache_add_condition_delayed (struct symbols_cache *cache,
return rspamd_symbols_cache_add_condition (cache, id, L, cbref);
}
- ncond = g_slice_alloc (sizeof (*ncond));
+ ncond = g_malloc0 (sizeof (*ncond));
ncond->sym = g_strdup (sym);
ncond->cbref = cbref;
ncond->L = L;
@@ -923,7 +923,7 @@ rspamd_symbols_cache_destroy (struct symbols_cache *cache)
ddep = cur->data;
g_free (ddep->from);
g_free (ddep->to);
- g_slice_free1 (sizeof (*ddep), ddep);
+ g_free (ddep);
cur = g_list_next (cur);
}
@@ -936,7 +936,7 @@ rspamd_symbols_cache_destroy (struct symbols_cache *cache)
while (cur) {
dcond = cur->data;
g_free (dcond->sym);
- g_slice_free1 (sizeof (*dcond), dcond);
+ g_free (dcond);
cur = g_list_next (cur);
}
@@ -956,7 +956,7 @@ rspamd_symbols_cache_destroy (struct symbols_cache *cache)
luaL_unref (cache->cfg->lua_state, LUA_REGISTRYINDEX, cache->peak_cb);
}
- g_slice_free1 (sizeof (*cache), cache);
+ g_free (cache);
}
}
@@ -965,7 +965,7 @@ rspamd_symbols_cache_new (struct rspamd_config *cfg)
{
struct symbols_cache *cache;
- cache = g_slice_alloc0 (sizeof (struct symbols_cache));
+ cache = g_malloc0 (sizeof (struct symbols_cache));
cache->static_pool =
rspamd_mempool_new (rspamd_mempool_suggest_size (), "symcache");
cache->items_by_symbol = g_hash_table_new (rspamd_str_hash,
@@ -2197,7 +2197,7 @@ rspamd_symbols_cache_add_delayed_dependency (struct symbols_cache *cache,
g_assert (from != NULL);
g_assert (to != NULL);
- ddep = g_slice_alloc (sizeof (*ddep));
+ ddep = g_malloc0 (sizeof (*ddep));
ddep->from = g_strdup (from);
ddep->to = g_strdup (to);
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index 1fd0ca1f5..22c784e07 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -717,7 +717,7 @@ rspamd_redis_async_cbdata_cleanup (struct rspamd_redis_stat_cbdata *cbdata)
ucl_object_unref (cbdata->cur);
}
- g_slice_free1 (sizeof (*cbdata), cbdata);
+ g_free (cbdata);
}
}
@@ -913,7 +913,7 @@ rspamd_redis_async_stat_cb (struct rspamd_stat_async_elt *elt, gpointer d)
/* Disable further events unless needed */
elt->enabled = FALSE;
- cbdata = g_slice_alloc0 (sizeof (*cbdata));
+ cbdata = g_malloc0 (sizeof (*cbdata));
cbdata->selected = rspamd_upstream_get (ctx->read_servers,
RSPAMD_UPSTREAM_ROUND_ROBIN,
NULL,
@@ -1346,7 +1346,7 @@ rspamd_redis_init (struct rspamd_stat_ctx *ctx,
const ucl_object_t *obj;
gboolean ret = FALSE;
- backend = g_slice_alloc0 (sizeof (*backend));
+ backend = g_malloc0 (sizeof (*backend));
/* First search in backend configuration */
obj = ucl_object_lookup (st->classifier->cfg->opts, "backend");
@@ -1387,14 +1387,14 @@ rspamd_redis_init (struct rspamd_stat_ctx *ctx,
if (!ret) {
msg_err_config ("cannot init redis backend for %s", stf->symbol);
- g_slice_free1 (sizeof (*backend), backend);
+ g_free (backend);
return NULL;
}
stf->clcf->flags |= RSPAMD_FLAG_CLASSIFIER_INCREMENTING_BACKEND;
backend->stcf = stf;
- st_elt = g_slice_alloc0 (sizeof (*st_elt));
+ st_elt = g_malloc0 (sizeof (*st_elt));
st_elt->ev_base = ctx->ev_base;
st_elt->ctx = backend;
backend->stat_elt = rspamd_stat_ctx_register_async (
@@ -1486,7 +1486,7 @@ rspamd_redis_close (gpointer p)
rspamd_upstreams_destroy (ctx->write_servers);
}
- g_slice_free1 (sizeof (*ctx), ctx);
+ g_free (ctx);
}
gboolean
diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c
index ab64e81a4..f5483b3ca 100644
--- a/src/libstat/stat_config.c
+++ b/src/libstat/stat_config.c
@@ -107,7 +107,7 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base)
guint lua_classifiers_cnt = 0, i;
if (stat_ctx == NULL) {
- stat_ctx = g_slice_alloc0 (sizeof (*stat_ctx));
+ stat_ctx = g_malloc0 (sizeof (*stat_ctx));
}
lua_getglobal (L, "rspamd_classifiers");
@@ -168,21 +168,21 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base)
while (cur) {
bk = NULL;
clf = cur->data;
- cl = g_slice_alloc0 (sizeof (*cl));
+ cl = g_malloc0 (sizeof (*cl));
cl->cfg = clf;
cl->ctx = stat_ctx;
cl->statfiles_ids = g_array_new (FALSE, FALSE, sizeof (gint));
cl->subrs = rspamd_stat_get_classifier (clf->classifier);
if (cl->subrs == NULL) {
- g_slice_free1 (sizeof (*cl), cl);
+ g_free (cl);
msg_err_config ("cannot init classifier type %s", clf->name);
cur = g_list_next (cur);
continue;
}
if (!cl->subrs->init_func (cfg->cfg_pool, cl)) {
- g_slice_free1 (sizeof (*cl), cl);
+ g_free (cl);
msg_err_config ("cannot init classifier type %s", clf->name);
cur = g_list_next (cur);
continue;
@@ -236,7 +236,7 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base)
while (curst) {
stf = curst->data;
- st = g_slice_alloc0 (sizeof (*st));
+ st = g_malloc0 (sizeof (*st));
st->classifier = cl;
st->stcf = stf;
@@ -273,7 +273,7 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base)
msg_err_config ("cannot init backend %s for statfile %s",
clf->backend, stf->symbol);
- g_slice_free1 (sizeof (*st), st);
+ g_free (st);
}
else {
st->id = stat_ctx->statfiles->len;
@@ -314,7 +314,7 @@ rspamd_stat_close (void)
st->backend->close (st->bkcf);
}
- g_slice_free1 (sizeof (*st), st);
+ g_free (st);
}
if (cl->cache && cl->cachecf) {
@@ -322,7 +322,7 @@ rspamd_stat_close (void)
}
g_array_free (cl->statfiles_ids, TRUE);
- g_slice_free1 (sizeof (*cl), cl);
+ g_free (cl);
}
cur = st_ctx->async_elts->head;
@@ -336,7 +336,7 @@ rspamd_stat_close (void)
g_queue_free (stat_ctx->async_elts);
g_ptr_array_free (st_ctx->statfiles, TRUE);
g_ptr_array_free (st_ctx->classifiers, TRUE);
- g_slice_free1 (sizeof (*st_ctx), st_ctx);
+ g_free (st_ctx);
/* Set global var to NULL */
stat_ctx = NULL;
@@ -436,7 +436,7 @@ rspamd_async_elt_dtor (struct rspamd_stat_async_elt *elt)
}
event_del (&elt->timer_ev);
- g_slice_free1 (sizeof (*elt), elt);
+ g_free (elt);
}
static void
@@ -468,7 +468,7 @@ rspamd_stat_ctx_register_async (rspamd_stat_async_handler handler,
st_ctx = rspamd_stat_get_ctx ();
g_assert (st_ctx != NULL);
- elt = g_slice_alloc (sizeof (*elt));
+ elt = g_malloc0 (sizeof (*elt));
REF_INIT_RETAIN (elt, rspamd_async_elt_dtor);
elt->handler = handler;
elt->cleanup = cleanup;
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index b4ee003ba..765046dec 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -109,10 +109,10 @@ rspamd_inet_addr_create (gint af)
{
rspamd_inet_addr_t *addr;
- addr = g_slice_alloc0 (sizeof (rspamd_inet_addr_t));
+ addr = g_malloc0 (sizeof (rspamd_inet_addr_t));
if (af == AF_UNIX) {
- addr->u.un = g_slice_alloc0 (sizeof (*addr->u.un));
+ addr->u.un = g_malloc0 (sizeof (*addr->u.un));
addr->slen = sizeof (addr->u.un->addr);
}
@@ -129,10 +129,10 @@ rspamd_inet_address_free (rspamd_inet_addr_t *addr)
if (addr) {
if (addr->af == AF_UNIX) {
if (addr->u.un) {
- g_slice_free1 (sizeof (*addr->u.un), addr->u.un);
+ g_free (addr->u.un);
}
}
- g_slice_free1 (sizeof (rspamd_inet_addr_t), addr);
+ g_free (addr);
}
}
@@ -1096,7 +1096,7 @@ rspamd_inet_address_recvfrom (gint fd, void *buf, gsize len, gint fl,
addr->slen = slen;
if (addr->af == AF_UNIX) {
- addr->u.un = g_slice_alloc (sizeof (*addr->u.un));
+ addr->u.un = g_malloc (sizeof (*addr->u.un));
memcpy (&addr->u.un->addr, &su.su, sizeof (struct sockaddr_un));
}
else {
diff --git a/src/libutil/aio_event.c b/src/libutil/aio_event.c
index 3e83cf979..584feb501 100644
--- a/src/libutil/aio_event.c
+++ b/src/libutil/aio_event.c
@@ -231,7 +231,7 @@ rspamd_eventfdcb (gint fd, gshort what, gpointer ud)
if (ev_data->io_buf) {
free (ev_data->io_buf);
}
- g_slice_free1 (sizeof (struct io_cbdata), ev_data);
+ g_free (ev_data);
}
}
else if (done == 0) {
@@ -337,7 +337,7 @@ rspamd_aio_read (gint fd,
struct iocb *iocb[1];
struct io_cbdata *cbdata;
- cbdata = g_slice_alloc (sizeof (struct io_cbdata));
+ cbdata = g_malloc0 (sizeof (struct io_cbdata));
cbdata->cb = cb;
cbdata->buf = buf;
cbdata->len = len;
@@ -414,7 +414,7 @@ rspamd_aio_write (gint fd,
struct iocb *iocb[1];
struct io_cbdata *cbdata;
- cbdata = g_slice_alloc (sizeof (struct io_cbdata));
+ cbdata = g_malloc0 (sizeof (struct io_cbdata));
cbdata->cb = cb;
cbdata->buf = buf;
cbdata->len = len;
diff --git a/src/libutil/expression.c b/src/libutil/expression.c
index dae574da5..3f631d918 100644
--- a/src/libutil/expression.c
+++ b/src/libutil/expression.c
@@ -366,7 +366,7 @@ rspamd_expression_destroy (struct rspamd_expression *expr)
g_node_destroy (expr->ast);
}
- g_slice_free1 (sizeof (*expr), expr);
+ g_free (expr);
}
}
@@ -598,7 +598,7 @@ rspamd_parse_expression (const gchar *line, gsize len,
p = line;
c = line;
end = line + len;
- e = g_slice_alloc (sizeof (*e));
+ e = g_malloc0 (sizeof (*e));
e->expressions = g_array_new (FALSE, FALSE,
sizeof (struct rspamd_expression_elt));
operand_stack = g_ptr_array_sized_new (32);
diff --git a/src/libutil/fstring.c b/src/libutil/fstring.c
index 101bfa9f0..8b5cae65b 100644
--- a/src/libutil/fstring.c
+++ b/src/libutil/fstring.c
@@ -383,7 +383,7 @@ rspamd_fstring_mapped_ftok_free (gpointer p)
storage = (rspamd_fstring_t *) (tok->begin - 2 * sizeof (gsize));
rspamd_fstring_free (storage);
- g_slice_free1 (sizeof (*tok), tok);
+ g_free (tok);
}
rspamd_ftok_t *
@@ -393,7 +393,7 @@ rspamd_ftok_map (const rspamd_fstring_t *s)
g_assert (s != NULL);
- tok = g_slice_alloc (sizeof (*tok));
+ tok = g_malloc (sizeof (*tok));
tok->begin = s->str;
tok->len = s->len;
diff --git a/src/libutil/hash.c b/src/libutil/hash.c
index 1afe947ee..18b01f2ec 100644
--- a/src/libutil/hash.c
+++ b/src/libutil/hash.c
@@ -60,7 +60,7 @@ rspamd_lru_destroy_node (gpointer value)
elt->hash->value_destroy (elt->data);
}
- g_slice_free1 (sizeof (*elt), elt);
+ g_free (elt);
}
}
@@ -190,7 +190,7 @@ rspamd_lru_create_node (rspamd_lru_hash_t *hash,
{
rspamd_lru_element_t *node;
- node = g_slice_alloc (sizeof (rspamd_lru_element_t));
+ node = g_malloc (sizeof (rspamd_lru_element_t));
node->data = value;
node->key = key;
node->ttl = TIME_TO_TS (ttl);
diff --git a/src/libutil/heap.c b/src/libutil/heap.c
index ae8e14131..601eb7893 100644
--- a/src/libutil/heap.c
+++ b/src/libutil/heap.c
@@ -90,7 +90,7 @@ rspamd_min_heap_create (gsize reserved_size)
{
struct rspamd_min_heap *heap;
- heap = g_slice_alloc (sizeof (*heap));
+ heap = g_malloc (sizeof (*heap));
heap->ar = g_ptr_array_sized_new (reserved_size);
return heap;
@@ -185,7 +185,7 @@ rspamd_min_heap_destroy (struct rspamd_min_heap *heap)
{
if (heap) {
g_ptr_array_free (heap->ar, TRUE);
- g_slice_free1 (sizeof (*heap), heap);
+ g_free (heap);
}
}
diff --git a/src/libutil/http.c b/src/libutil/http.c
index 5832f0007..60378f8a1 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -125,7 +125,7 @@ rspamd_http_privbuf_dtor (gpointer ud)
rspamd_fstring_free (p->data);
}
- g_slice_free1 (sizeof (struct _rspamd_http_privbuf), p);
+ g_free (p);
}
static const gchar *
@@ -549,7 +549,7 @@ rspamd_http_finish_header (struct rspamd_http_connection *conn,
static void
rspamd_http_init_header (struct rspamd_http_connection_private *priv)
{
- priv->header = g_slice_alloc0 (sizeof (struct rspamd_http_header));
+ priv->header = g_malloc0 (sizeof (struct rspamd_http_header));
priv->header->combined = rspamd_fstring_new ();
}
@@ -860,7 +860,7 @@ rspamd_http_decrypt_message (struct rspamd_http_connection *conn,
DL_FOREACH_SAFE (hdr, hcur, hcurtmp) {
rspamd_fstring_free (hcur->combined);
- g_slice_free1 (sizeof (struct rspamd_http_header), hcur);
+ g_free (hcur);
}
}
@@ -1310,7 +1310,7 @@ rspamd_http_connection_new (
return NULL;
}
- conn = g_slice_alloc0 (sizeof (struct rspamd_http_connection));
+ conn = g_malloc0 (sizeof (struct rspamd_http_connection));
conn->opts = opts;
conn->type = type;
conn->body_handler = body_handler;
@@ -1322,7 +1322,7 @@ rspamd_http_connection_new (
conn->cache = cache;
/* Init priv */
- priv = g_slice_alloc0 (sizeof (struct rspamd_http_connection_private));
+ priv = g_malloc0 (sizeof (struct rspamd_http_connection_private));
conn->priv = priv;
priv->ssl_ctx = ssl_ctx;
@@ -1369,7 +1369,7 @@ rspamd_http_connection_reset (struct rspamd_http_connection *conn)
}
if (priv->out != NULL) {
- g_slice_free1 (sizeof (struct iovec) * priv->outlen, priv->out);
+ g_free (priv->out);
priv->out = NULL;
}
@@ -1485,7 +1485,7 @@ rspamd_http_connection_copy_msg (struct rspamd_http_message *msg)
nhdrs = NULL;
DL_FOREACH (hdr, hcur) {
- nhdr = g_slice_alloc (sizeof (struct rspamd_http_header));
+ nhdr = g_malloc (sizeof (struct rspamd_http_header));
nhdr->combined = rspamd_fstring_new_init (hcur->combined->str,
hcur->combined->len);
@@ -1527,10 +1527,10 @@ rspamd_http_connection_free (struct rspamd_http_connection *conn)
rspamd_pubkey_unref (priv->peer_key);
}
- g_slice_free1 (sizeof (struct rspamd_http_connection_private), priv);
+ g_free (priv);
}
- g_slice_free1 (sizeof (struct rspamd_http_connection), conn);
+ g_free (conn);
}
static void
@@ -1567,7 +1567,7 @@ rspamd_http_connection_read_message_common (struct rspamd_http_connection *conn,
}
priv->header = NULL;
- priv->buf = g_slice_alloc0 (sizeof (*priv->buf));
+ priv->buf = g_malloc0 (sizeof (*priv->buf));
REF_INIT_RETAIN (priv->buf, rspamd_http_privbuf_dtor);
priv->buf->data = rspamd_fstring_sized_new (8192);
priv->flags |= RSPAMD_HTTP_CONN_FLAG_NEW_HEADER;
@@ -1992,7 +1992,7 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn
}
priv->header = NULL;
- priv->buf = g_slice_alloc0 (sizeof (*priv->buf));
+ priv->buf = g_malloc0 (sizeof (*priv->buf));
REF_INIT_RETAIN (priv->buf, rspamd_http_privbuf_dtor);
priv->buf->data = rspamd_fstring_sized_new (512);
buf = priv->buf->data;
@@ -2183,7 +2183,7 @@ rspamd_http_connection_write_message_common (struct rspamd_http_connection *conn
}
/* Allocate iov */
- priv->out = g_slice_alloc (sizeof (struct iovec) * priv->outlen);
+ priv->out = g_malloc0 (sizeof (struct iovec) * priv->outlen);
priv->wr_pos = 0;
meth_len = rspamd_http_message_write_header (mime_type, encrypted,
@@ -2346,7 +2346,7 @@ rspamd_http_new_message (enum http_parser_type type)
{
struct rspamd_http_message *new;
- new = g_slice_alloc0 (sizeof (struct rspamd_http_message));
+ new = g_malloc0 (sizeof (struct rspamd_http_message));
if (type == HTTP_REQUEST) {
new->url = rspamd_fstring_new ();
@@ -2460,7 +2460,7 @@ rspamd_http_shname_dtor (void *p)
unlink (n->shm_name);
#endif
g_free (n->shm_name);
- g_slice_free1 (sizeof (*n), n);
+ g_free (n);
}
struct rspamd_storage_shmem *
@@ -2496,7 +2496,7 @@ rspamd_http_message_set_body (struct rspamd_http_message *msg,
rspamd_http_message_storage_cleanup (msg);
if (msg->flags & RSPAMD_HTTP_FLAG_SHMEM) {
- storage->shared.name = g_slice_alloc (sizeof (*storage->shared.name));
+ storage->shared.name = g_malloc (sizeof (*storage->shared.name));
REF_INIT_RETAIN (storage->shared.name, rspamd_http_shname_dtor);
#ifdef HAVE_SANE_SHMEM
#if defined(__DragonFly__)
@@ -2803,7 +2803,7 @@ rspamd_http_message_free (struct rspamd_http_message *msg)
DL_FOREACH_SAFE (hdr, hcur, hcurtmp) {
rspamd_fstring_free (hcur->combined);
- g_slice_free1 (sizeof (struct rspamd_http_header), hcur);
+ g_free (hcur);
}
}
@@ -2823,7 +2823,7 @@ rspamd_http_message_free (struct rspamd_http_message *msg)
rspamd_pubkey_unref (msg->peer_key);
}
- g_slice_free1 (sizeof (struct rspamd_http_message), msg);
+ g_free (msg);
}
void
@@ -2852,7 +2852,7 @@ rspamd_http_message_add_header_len (struct rspamd_http_message *msg,
guint nlen, vlen;
if (msg != NULL && name != NULL && value != NULL) {
- hdr = g_slice_alloc (sizeof (struct rspamd_http_header));
+ hdr = g_malloc0 (sizeof (struct rspamd_http_header));
nlen = strlen (name);
vlen = len;
hdr->combined = rspamd_fstring_sized_new (nlen + vlen + 4);
@@ -2894,7 +2894,7 @@ rspamd_http_message_add_header_fstr (struct rspamd_http_message *msg,
guint nlen, vlen;
if (msg != NULL && name != NULL && value != NULL) {
- hdr = g_slice_alloc (sizeof (struct rspamd_http_header));
+ hdr = g_malloc0 (sizeof (struct rspamd_http_header));
nlen = strlen (name);
vlen = value->len;
hdr->combined = rspamd_fstring_sized_new (nlen + vlen + 4);
@@ -2979,7 +2979,7 @@ rspamd_http_message_remove_header (struct rspamd_http_message *msg,
DL_FOREACH_SAFE (hdr, hcur, hcurtmp) {
rspamd_fstring_free (hcur->combined);
- g_slice_free1 (sizeof (*hcur), hcur);
+ g_free (hcur);
}
}
}
@@ -3002,7 +3002,7 @@ rspamd_http_entry_free (struct rspamd_http_connection_entry *entry)
}
DL_DELETE (entry->rt->conns, entry);
- g_slice_free1 (sizeof (struct rspamd_http_connection_entry), entry);
+ g_free (entry);
}
}
@@ -3321,7 +3321,7 @@ rspamd_http_router_new (rspamd_http_router_error_handler_t eh,
struct rspamd_http_connection_router * new;
struct stat st;
- new = g_slice_alloc0 (sizeof (struct rspamd_http_connection_router));
+ new = g_malloc0 (sizeof (struct rspamd_http_connection_router));
new->paths = g_hash_table_new_full (rspamd_ftok_icase_hash,
rspamd_ftok_icase_equal, rspamd_fstring_mapped_ftok_free, NULL);
new->regexps = g_ptr_array_new ();
@@ -3383,7 +3383,7 @@ rspamd_http_router_add_path (struct rspamd_http_connection_router *router,
if (path != NULL && handler != NULL && router != NULL) {
memcpy (&ptr, &handler, sizeof (ptr));
storage = rspamd_fstring_new_init (path, strlen (path));
- key = g_slice_alloc0 (sizeof (*key));
+ key = g_malloc0 (sizeof (*key));
key->begin = storage->str;
key->len = storage->len;
g_hash_table_insert (router->paths, key, ptr);
@@ -3446,7 +3446,7 @@ rspamd_http_router_handle_socket (struct rspamd_http_connection_router *router,
{
struct rspamd_http_connection_entry *conn;
- conn = g_slice_alloc0 (sizeof (struct rspamd_http_connection_entry));
+ conn = g_malloc0 (sizeof (struct rspamd_http_connection_entry));
conn->rt = router;
conn->ud = ud;
conn->is_reply = FALSE;
@@ -3500,7 +3500,7 @@ rspamd_http_router_free (struct rspamd_http_connection_router *router)
g_ptr_array_free (router->regexps, TRUE);
g_hash_table_unref (router->paths);
g_hash_table_unref (router->response_headers);
- g_slice_free1 (sizeof (struct rspamd_http_connection_router), router);
+ g_free (router);
}
}
diff --git a/src/libutil/logger.c b/src/libutil/logger.c
index de301cc62..7bfd85183 100644
--- a/src/libutil/logger.c
+++ b/src/libutil/logger.c
@@ -371,7 +371,7 @@ rspamd_set_logger (struct rspamd_config *cfg,
rspamd_logger_t *logger;
if (plogger == NULL || *plogger == NULL) {
- logger = g_slice_alloc0 (sizeof (rspamd_logger_t));
+ logger = g_malloc0 (sizeof (rspamd_logger_t));
if (cfg->log_error_elts > 0 && pool) {
logger->errlog = rspamd_mempool_alloc0_shared (pool,
diff --git a/src/libutil/map.c b/src/libutil/map.c
index 892bf0e0c..6327b426b 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -277,7 +277,7 @@ free_http_cbdata_common (struct http_callback_data *cbd, gboolean plan_new)
MAP_RELEASE (cbd->bk, "rspamd_map_backend");
MAP_RELEASE (periodic, "periodic");
- g_slice_free1 (sizeof (struct http_callback_data), cbd);
+ g_free (cbd);
}
static void
@@ -346,7 +346,7 @@ rspamd_map_cache_cb (gint fd, short what, gpointer ud)
MAP_RELEASE (cache_cbd->shm, "rspamd_http_map_cached_cbdata");
msg_debug_map ("cached data is now expired (gen missmatch) for %s", map->name);
event_del (&cache_cbd->timeout);
- g_slice_free1 (sizeof (*cache_cbd), cache_cbd);
+ g_free (cache_cbd);
}
else if (cache_cbd->data->last_checked > cache_cbd->last_checked) {
/*
@@ -363,7 +363,7 @@ rspamd_map_cache_cb (gint fd, short what, gpointer ud)
MAP_RELEASE (cache_cbd->shm, "rspamd_http_map_cached_cbdata");
msg_debug_map ("cached data is now expired for %s", map->name);
event_del (&cache_cbd->timeout);
- g_slice_free1 (sizeof (*cache_cbd), cache_cbd);
+ g_free (cache_cbd);
}
}
@@ -636,7 +636,7 @@ read_data:
sizeof (map->cache->shmem_name));
map->cache->len = cbd->data_len;
map->cache->last_modified = cbd->data->last_modified;
- cache_cbd = g_slice_alloc0 (sizeof (*cache_cbd));
+ cache_cbd = g_malloc0 (sizeof (*cache_cbd));
cache_cbd->shm = cbd->shmem_data;
cache_cbd->map = map;
cache_cbd->data = cbd->data;
@@ -986,7 +986,7 @@ rspamd_map_periodic_dtor (struct map_periodic_cbdata *periodic)
msg_debug_map ("unlocked map");
}
- g_slice_free1 (sizeof (*periodic), periodic);
+ g_free (periodic);
}
static void
@@ -1037,7 +1037,7 @@ rspamd_map_schedule_periodic (struct rspamd_map *map,
jittered_sec = rspamd_time_jitter (timeout, 0);
}
- cbd = g_slice_alloc0 (sizeof (*cbd));
+ cbd = g_malloc0 (sizeof (*cbd));
cbd->cbdata.state = 0;
cbd->cbdata.prev_data = *map->user_data;
cbd->cbdata.cur_data = NULL;
@@ -1267,7 +1267,7 @@ rspamd_map_common_http_callback (struct rspamd_map *map,
}
check:
- cbd = g_slice_alloc0 (sizeof (struct http_callback_data));
+ cbd = g_malloc0 (sizeof (struct http_callback_data));
cbd->ev_base = map->ev_base;
cbd->map = map;
@@ -1741,7 +1741,7 @@ rspamd_map_backend_dtor (struct rspamd_map_backend *bk)
case MAP_PROTO_FILE:
if (bk->data.fd) {
g_free (bk->data.fd->filename);
- g_slice_free1 (sizeof (*bk->data.fd), bk->data.fd);
+ g_free (bk->data.fd);
}
break;
case MAP_PROTO_STATIC:
@@ -1756,7 +1756,7 @@ rspamd_map_backend_dtor (struct rspamd_map_backend *bk)
if (bk->data.hd) {
g_free (bk->data.hd->host);
g_free (bk->data.hd->path);
- g_slice_free1 (sizeof (*bk->data.hd), bk->data.hd);
+ g_free (bk->data.hd);
}
break;
}
@@ -1765,7 +1765,7 @@ rspamd_map_backend_dtor (struct rspamd_map_backend *bk)
rspamd_pubkey_unref (bk->trusted_pubkey);
}
- g_slice_free1 (sizeof (*bk), bk);
+ g_free (bk);
}
static struct rspamd_map_backend *
@@ -1779,7 +1779,7 @@ rspamd_map_parse_backend (struct rspamd_config *cfg, const gchar *map_line)
const gchar *end, *p;
rspamd_ftok_t tok;
- bk = g_slice_alloc0 (sizeof (*bk));
+ bk = g_malloc0 (sizeof (*bk));
REF_INIT_RETAIN (bk, rspamd_map_backend_dtor);
if (!rspamd_map_check_proto (cfg, map_line, bk)) {
@@ -1800,7 +1800,7 @@ rspamd_map_parse_backend (struct rspamd_config *cfg, const gchar *map_line)
/* Now check for each proto separately */
if (bk->protocol == MAP_PROTO_FILE) {
- fdata = g_slice_alloc0 (sizeof (struct file_map_data));
+ fdata = g_malloc0 (sizeof (struct file_map_data));
fdata->st.st_mtime = -1;
if (access (bk->uri, R_OK) == -1) {
@@ -1818,7 +1818,7 @@ rspamd_map_parse_backend (struct rspamd_config *cfg, const gchar *map_line)
bk->data.fd = fdata;
}
else if (bk->protocol == MAP_PROTO_HTTP || bk->protocol == MAP_PROTO_HTTPS) {
- hdata = g_slice_alloc0 (sizeof (struct http_map_data));
+ hdata = g_malloc0 (sizeof (struct http_map_data));
memset (&up, 0, sizeof (up));
if (http_parser_parse_url (bk->uri, strlen (bk->uri), FALSE,
@@ -1858,7 +1858,7 @@ rspamd_map_parse_backend (struct rspamd_config *cfg, const gchar *map_line)
bk->data.hd = hdata;
}else if (bk->protocol == MAP_PROTO_STATIC) {
- sdata = g_slice_alloc0 (sizeof (*sdata));
+ sdata = g_malloc0 (sizeof (*sdata));
bk->data.sd = sdata;
}
@@ -1871,7 +1871,7 @@ err:
MAP_RELEASE (bk, "rspamd_map_backend");
if (hdata) {
- g_slice_free1 (sizeof (*hdata), hdata);
+ g_free (hdata);
}
return NULL;
@@ -2647,7 +2647,7 @@ rspamd_regexp_map_create (struct rspamd_map *map,
{
struct rspamd_regexp_map *re_map;
- re_map = g_slice_alloc0 (sizeof (*re_map));
+ re_map = g_malloc0 (sizeof (*re_map));
re_map->values = g_ptr_array_new ();
re_map->regexps = g_ptr_array_new ();
re_map->map = map;
@@ -2693,7 +2693,7 @@ rspamd_regexp_map_destroy (struct rspamd_regexp_map *re_map)
}
#endif
- g_slice_free1 (sizeof (*re_map), re_map);
+ g_free (re_map);
}
static void
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c
index 508ffcda9..e55b5d0b5 100644
--- a/src/libutil/multipattern.c
+++ b/src/libutil/multipattern.c
@@ -338,7 +338,7 @@ rspamd_multipattern_create (enum rspamd_multipattern_flags flags)
{
struct rspamd_multipattern *mp;
- mp = g_slice_alloc0 (sizeof (*mp));
+ mp = g_malloc0 (sizeof (*mp));
mp->flags = flags;
#ifdef WITH_HYPERSCAN
@@ -363,7 +363,7 @@ rspamd_multipattern_create_sized (guint npatterns,
{
struct rspamd_multipattern *mp;
- mp = g_slice_alloc0 (sizeof (*mp));
+ mp = g_malloc0 (sizeof (*mp));
mp->flags = flags;
#ifdef WITH_HYPERSCAN
@@ -744,7 +744,7 @@ rspamd_multipattern_destroy (struct rspamd_multipattern *mp)
g_array_free (mp->hs_pats, TRUE);
g_array_free (mp->hs_ids, TRUE);
g_array_free (mp->hs_flags, TRUE);
- g_slice_free1 (sizeof (*mp), mp);
+ g_free (mp);
return;
}
@@ -762,7 +762,7 @@ rspamd_multipattern_destroy (struct rspamd_multipattern *mp)
g_array_free (mp->pats, TRUE);
- g_slice_free1 (sizeof (*mp), mp);
+ g_free (mp);
}
}
diff --git a/src/libutil/radix.c b/src/libutil/radix.c
index b44391bfc..bb295d7d1 100644
--- a/src/libutil/radix.c
+++ b/src/libutil/radix.c
@@ -114,7 +114,7 @@ radix_create_compressed (void)
{
radix_compressed_t *tree;
- tree = g_slice_alloc (sizeof (*tree));
+ tree = g_malloc0 (sizeof (*tree));
if (tree == NULL) {
return NULL;
}
@@ -131,7 +131,7 @@ radix_destroy_compressed (radix_compressed_t *tree)
{
if (tree) {
rspamd_mempool_delete (tree->pool);
- g_slice_free1 (sizeof (*tree), tree);
+ g_free (tree);
}
}
diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c
index 6d76beabd..a90bd5e36 100644
--- a/src/libutil/ssl_util.c
+++ b/src/libutil/ssl_util.c
@@ -474,7 +474,7 @@ rspamd_ssl_connection_new (gpointer ssl_ctx, struct event_base *ev_base,
struct rspamd_ssl_connection *c;
g_assert (ssl_ctx != NULL);
- c = g_slice_alloc0 (sizeof (*c));
+ c = g_malloc0 (sizeof (*c));
c->ssl = SSL_new (ssl_ctx);
c->ev_base = ev_base;
c->verify_peer = verify_peer;
@@ -753,6 +753,6 @@ rspamd_ssl_connection_free (struct rspamd_ssl_connection *conn)
g_free (conn->hostname);
}
- g_slice_free1 (sizeof (*conn), conn);
+ g_free (conn);
}
}
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index b72c80a15..30b8aeb2d 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -393,7 +393,7 @@ rspamd_init_lua_locked (struct rspamd_config *cfg)
{
struct lua_locked_state *new;
- new = g_slice_alloc (sizeof (struct lua_locked_state));
+ new = g_malloc0 (sizeof (struct lua_locked_state));
new->L = rspamd_lua_init ();
new->m = rspamd_mutex_new ();
@@ -413,7 +413,7 @@ rspamd_free_lua_locked (struct lua_locked_state *st)
rspamd_mutex_free (st->m);
- g_slice_free1 (sizeof (struct lua_locked_state), st);
+ g_free (st);
}
gboolean
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 4aec7ff5a..6407852b2 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -2438,7 +2438,7 @@ lua_config_add_on_load (lua_State *L)
return luaL_error (L, "invalid arguments");
}
- sc = g_slice_alloc0 (sizeof (*sc));
+ sc = g_malloc0 (sizeof (*sc));
lua_pushvalue (L, 2);
sc->cbref = luaL_ref (L, LUA_REGISTRYINDEX);
DL_APPEND (cfg->on_load, sc);
@@ -2505,7 +2505,7 @@ lua_periodic_callback (gint unused_fd, short what, gpointer ud)
}
else {
luaL_unref (L, LUA_REGISTRYINDEX, periodic->cbref);
- g_slice_free1 (sizeof (*periodic), periodic);
+ g_free (periodic);
}
}
@@ -2527,7 +2527,7 @@ lua_config_add_periodic (lua_State *L)
need_jitter = lua_toboolean (L, 5);
}
- periodic = g_slice_alloc0 (sizeof (*periodic));
+ periodic = g_malloc0 (sizeof (*periodic));
periodic->timeout = timeout;
periodic->L = L;
periodic->cfg = cfg;
@@ -2698,7 +2698,7 @@ lua_config_register_finish_script (lua_State *L)
struct rspamd_config_post_load_script *sc;
if (cfg != NULL && lua_type (L, 2) == LUA_TFUNCTION) {
- sc = g_slice_alloc0 (sizeof (*sc));
+ sc = g_malloc0 (sizeof (*sc));
lua_pushvalue (L, 2);
sc->cbref = luaL_ref (L, LUA_REGISTRYINDEX);
DL_APPEND (cfg->finish_callbacks, sc);
diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c
index d5be56460..b646b0926 100644
--- a/src/lua/lua_cryptobox.c
+++ b/src/lua/lua_cryptobox.c
@@ -735,7 +735,7 @@ rspamd_lua_hash_create (const gchar *type)
{
struct rspamd_lua_cryptobox_hash *h;
- h = g_slice_alloc0 (sizeof (*h));
+ h = g_malloc0 (sizeof (*h));
if (type) {
if (g_ascii_strcasecmp (type, "md5") == 0) {
@@ -776,7 +776,7 @@ rspamd_lua_hash_create (const gchar *type)
}
}
- h->h = g_slice_alloc0 (sizeof (*h->h));
+ h->h = g_malloc0 (sizeof (*h->h));
rspamd_cryptobox_hash_init (h->h, NULL, 0);
ret:
@@ -1147,10 +1147,10 @@ lua_cryptobox_hash_gc (lua_State *L)
}
else {
rspamd_explicit_memzero (h->h, sizeof (*h->h));
- g_slice_free1 (sizeof (*h->h), h->h);
+ g_free (h->h);
}
- g_slice_free1 (sizeof (*h), h);
+ g_free (h);
return 0;
}
diff --git a/src/lua/lua_fann.c b/src/lua/lua_fann.c
index 4f00dba28..c7fdc6c70 100644
--- a/src/lua/lua_fann.c
+++ b/src/lua/lua_fann.c
@@ -637,7 +637,7 @@ lua_fann_thread_notify (gint fd, short what, gpointer ud)
fann_destroy_train (cbdata->train);
luaL_unref (cbdata->L, LUA_REGISTRYINDEX, cbdata->cbref);
- g_slice_free1 (sizeof (*cbdata), cbdata);
+ g_free (cbdata);
}
static void *
@@ -701,7 +701,7 @@ lua_fann_train_threaded (lua_State *L)
ndata = rspamd_lua_table_size (L, 2);
ninputs = fann_get_num_input (f);
noutputs = fann_get_num_output (f);
- cbdata = g_slice_alloc0 (sizeof (*cbdata));
+ cbdata = g_malloc0 (sizeof (*cbdata));
cbdata->L = L;
cbdata->f = f;
cbdata->train = rspamd_fann_create_train (ndata, ninputs, noutputs);
@@ -791,7 +791,7 @@ err:
fann_destroy_train (cbdata->train);
luaL_unref (L, LUA_REGISTRYINDEX, cbdata->cbref);
- g_slice_free1 (sizeof (*cbdata), cbdata);
+ g_free (cbdata);
return luaL_error (L, "invalid arguments");
#endif
}
@@ -831,7 +831,7 @@ lua_fann_test (lua_State *L)
}
}
- cur_input = g_slice_alloc (ninputs * sizeof (fann_type));
+ cur_input = g_malloc0 (ninputs * sizeof (fann_type));
for (i = 0; i < ninputs; i++) {
lua_rawgeti (L, tbl_idx, i + 1);
@@ -848,7 +848,7 @@ lua_fann_test (lua_State *L)
lua_rawseti (L, -2, i + 1);
}
- g_slice_free1 (ninputs * sizeof (fann_type), cur_input);
+ g_free (cur_input);
}
else {
lua_pushnil (L);
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index bf3af6c56..e05c63602 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -131,7 +131,7 @@ lua_http_fin (gpointer arg)
rspamd_pubkey_unref (cbd->peer_pk);
}
- g_slice_free1 (sizeof (struct lua_http_cbdata), cbd);
+ g_free (cbd);
}
static void
@@ -612,7 +612,7 @@ lua_http_request (lua_State *L)
return 1;
}
- cbd = g_slice_alloc0 (sizeof (*cbd));
+ cbd = g_malloc0 (sizeof (*cbd));
cbd->L = L;
cbd->cbref = cbref;
cbd->msg = msg;
diff --git a/src/lua/lua_ip.c b/src/lua/lua_ip.c
index ba457f727..31b74ab12 100644
--- a/src/lua/lua_ip.c
+++ b/src/lua/lua_ip.c
@@ -192,7 +192,7 @@ lua_ip_new (lua_State *L, struct rspamd_lua_ip *old)
{
struct rspamd_lua_ip *ip, **pip;
- ip = g_slice_alloc (sizeof (*ip));
+ ip = g_malloc0 (sizeof (*ip));
if (old != NULL && old->addr != NULL) {
ip->addr = rspamd_inet_address_copy (old->addr);
@@ -406,7 +406,7 @@ lua_ip_destroy (lua_State *L)
if (ip->addr) {
rspamd_inet_address_free (ip->addr);
}
- g_slice_free1 (sizeof (struct rspamd_lua_ip), ip);
+ g_free (ip);
}
return 0;
@@ -519,7 +519,7 @@ rspamd_lua_ip_push (lua_State *L, rspamd_inet_addr_t *addr)
{
struct rspamd_lua_ip *ip, **pip;
- ip = g_slice_alloc0 (sizeof (struct rspamd_lua_ip));
+ ip = g_malloc0 (sizeof (struct rspamd_lua_ip));
ip->addr = rspamd_inet_address_copy (addr);
pip = lua_newuserdata (L, sizeof (struct rspamd_lua_ip *));
rspamd_lua_setclass (L, "rspamd{ip}", -1);
@@ -535,7 +535,7 @@ rspamd_lua_ip_push_fromstring (lua_State *L, const gchar *ip_str)
lua_pushnil (L);
}
else {
- ip = g_slice_alloc0 (sizeof (struct rspamd_lua_ip));
+ ip = g_malloc0 (sizeof (struct rspamd_lua_ip));
if (rspamd_parse_inet_address (&ip->addr, ip_str, 0)) {
@@ -544,7 +544,7 @@ rspamd_lua_ip_push_fromstring (lua_State *L, const gchar *ip_str)
*pip = ip;
}
else {
- g_slice_free1 (sizeof (*ip), ip);
+ g_free (ip);
lua_pushnil (L);
}
}
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index b2041c704..24273c8c4 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -961,7 +961,7 @@ lua_util_tokenize_text (lua_State *L)
lua_pop (L, 1);
if (ex_len > 0) {
- ex = g_slice_alloc (sizeof (*ex));
+ ex = g_malloc0 (sizeof (*ex));
ex->pos = pos;
ex->len = ex_len;
exceptions = g_list_prepend (exceptions, ex);
@@ -1000,7 +1000,7 @@ lua_util_tokenize_text (lua_State *L)
cur = exceptions;
while (cur) {
ex = cur->data;
- g_slice_free1 (sizeof (*ex), ex);
+ g_free (ex);
cur = g_list_next (cur);
}
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index a44524e70..4a8dc9654 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -110,7 +110,7 @@ exceptions_free_value (gpointer v)
rspamd_ftok_t *val = v;
g_free ((gpointer)val->begin);
- g_slice_free1 (sizeof (*val), val);
+ g_free (val);
}
static void
@@ -134,7 +134,7 @@ exception_insert (gpointer st, gconstpointer key, gconstpointer value)
return;
}
- val = g_slice_alloc (sizeof (rspamd_ftok_t));
+ val = g_malloc (sizeof (rspamd_ftok_t));
val->begin = g_strdup (key);
val->len = strlen (key);
@@ -214,7 +214,7 @@ redirector_insert (gpointer st, gconstpointer key, gconstpointer value)
}
pat = rspamd_fstring_new_init (begin, p - begin);
- tok = g_slice_alloc (sizeof (*tok));
+ tok = g_malloc0 (sizeof (*tok));
tok->begin = pat->str;
tok->len = pat->len;