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);
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;
uncomp_sz += tmp;
}
- f = g_slice_alloc0 (sizeof (*f));
+ f = g_malloc0 (sizeof (*f));
if (flags & 0x200) {
/* We have unicode + normal version */
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);
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);
}
g_free ((void *)addr->user);
}
- g_slice_free1 (sizeof (*addr), addr);
+ g_free (addr);
}
static void
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] == '"') {
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));
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
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));
if (st) {
g_ptr_array_free (st->stack, TRUE);
g_array_free (st->boundaries, TRUE);
- g_slice_free1 (sizeof (*st), st);
+ g_free (st);
}
}
* 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;
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;
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
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
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 *
{
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);
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;
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);
}
/*
* 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++);
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);
}
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;
}
}
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;
{
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
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) {
if (addr) {
g_free (addr->spf_string);
DL_FOREACH_SAFE (addr, cur, tmp) {
- g_slice_free1 (sizeof (*cur), cur);
+ g_free (cur);
}
}
}
{
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);
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);
g_free (r->domain);
g_array_free (r->elts, TRUE);
- g_slice_free1 (sizeof (*r), r);
+ g_free (r);
}
static void
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);
}
}
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;
}
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;
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);
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);
}
}
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) {
struct symbols_cache_order *ord = p;
g_ptr_array_free (ord->d, TRUE);
- g_slice_free1 (sizeof (*ord), ord);
+ g_free (ord);
}
static void
{
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);
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;
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);
}
while (cur) {
dcond = cur->data;
g_free (dcond->sym);
- g_slice_free1 (sizeof (*dcond), dcond);
+ g_free (dcond);
cur = g_list_next (cur);
}
luaL_unref (cache->cfg->lua_state, LUA_REGISTRYINDEX, cache->peak_cb);
}
- g_slice_free1 (sizeof (*cache), cache);
+ g_free (cache);
}
}
{
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,
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);
ucl_object_unref (cbdata->cur);
}
- g_slice_free1 (sizeof (*cbdata), cbdata);
+ g_free (cbdata);
}
}
/* 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,
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");
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 (
rspamd_upstreams_destroy (ctx->write_servers);
}
- g_slice_free1 (sizeof (*ctx), ctx);
+ g_free (ctx);
}
gboolean
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");
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;
while (curst) {
stf = curst->data;
- st = g_slice_alloc0 (sizeof (*st));
+ st = g_malloc0 (sizeof (*st));
st->classifier = cl;
st->stcf = stf;
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;
st->backend->close (st->bkcf);
}
- g_slice_free1 (sizeof (*st), st);
+ g_free (st);
}
if (cl->cache && cl->cachecf) {
}
g_array_free (cl->statfiles_ids, TRUE);
- g_slice_free1 (sizeof (*cl), cl);
+ g_free (cl);
}
cur = st_ctx->async_elts->head;
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;
}
event_del (&elt->timer_ev);
- g_slice_free1 (sizeof (*elt), elt);
+ g_free (elt);
}
static void
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;
{
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);
}
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);
}
}
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 {
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) {
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;
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;
g_node_destroy (expr->ast);
}
- g_slice_free1 (sizeof (*expr), expr);
+ g_free (expr);
}
}
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);
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 *
g_assert (s != NULL);
- tok = g_slice_alloc (sizeof (*tok));
+ tok = g_malloc (sizeof (*tok));
tok->begin = s->str;
tok->len = s->len;
elt->hash->value_destroy (elt->data);
}
- g_slice_free1 (sizeof (*elt), elt);
+ g_free (elt);
}
}
{
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);
{
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;
{
if (heap) {
g_ptr_array_free (heap->ar, TRUE);
- g_slice_free1 (sizeof (*heap), heap);
+ g_free (heap);
}
}
rspamd_fstring_free (p->data);
}
- g_slice_free1 (sizeof (struct _rspamd_http_privbuf), p);
+ g_free (p);
}
static const gchar *
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 ();
}
DL_FOREACH_SAFE (hdr, hcur, hcurtmp) {
rspamd_fstring_free (hcur->combined);
- g_slice_free1 (sizeof (struct rspamd_http_header), hcur);
+ g_free (hcur);
}
}
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;
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;
}
if (priv->out != NULL) {
- g_slice_free1 (sizeof (struct iovec) * priv->outlen, priv->out);
+ g_free (priv->out);
priv->out = NULL;
}
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);
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
}
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;
}
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;
}
/* 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,
{
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 ();
unlink (n->shm_name);
#endif
g_free (n->shm_name);
- g_slice_free1 (sizeof (*n), n);
+ g_free (n);
}
struct rspamd_storage_shmem *
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__)
DL_FOREACH_SAFE (hdr, hcur, hcurtmp) {
rspamd_fstring_free (hcur->combined);
- g_slice_free1 (sizeof (struct rspamd_http_header), hcur);
+ g_free (hcur);
}
}
rspamd_pubkey_unref (msg->peer_key);
}
- g_slice_free1 (sizeof (struct rspamd_http_message), msg);
+ g_free (msg);
}
void
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);
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);
DL_FOREACH_SAFE (hdr, hcur, hcurtmp) {
rspamd_fstring_free (hcur->combined);
- g_slice_free1 (sizeof (*hcur), hcur);
+ g_free (hcur);
}
}
}
}
DL_DELETE (entry->rt->conns, entry);
- g_slice_free1 (sizeof (struct rspamd_http_connection_entry), entry);
+ g_free (entry);
}
}
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 ();
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);
{
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;
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);
}
}
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,
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
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) {
/*
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);
}
}
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;
msg_debug_map ("unlocked map");
}
- g_slice_free1 (sizeof (*periodic), periodic);
+ g_free (periodic);
}
static void
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;
}
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;
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:
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;
}
rspamd_pubkey_unref (bk->trusted_pubkey);
}
- g_slice_free1 (sizeof (*bk), bk);
+ g_free (bk);
}
static struct rspamd_map_backend *
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)) {
/* 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) {
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,
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;
}
MAP_RELEASE (bk, "rspamd_map_backend");
if (hdata) {
- g_slice_free1 (sizeof (*hdata), hdata);
+ g_free (hdata);
}
return NULL;
{
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;
}
#endif
- g_slice_free1 (sizeof (*re_map), re_map);
+ g_free (re_map);
}
static void
{
struct rspamd_multipattern *mp;
- mp = g_slice_alloc0 (sizeof (*mp));
+ mp = g_malloc0 (sizeof (*mp));
mp->flags = flags;
#ifdef WITH_HYPERSCAN
{
struct rspamd_multipattern *mp;
- mp = g_slice_alloc0 (sizeof (*mp));
+ mp = g_malloc0 (sizeof (*mp));
mp->flags = flags;
#ifdef WITH_HYPERSCAN
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;
}
g_array_free (mp->pats, TRUE);
- g_slice_free1 (sizeof (*mp), mp);
+ g_free (mp);
}
}
{
radix_compressed_t *tree;
- tree = g_slice_alloc (sizeof (*tree));
+ tree = g_malloc0 (sizeof (*tree));
if (tree == NULL) {
return NULL;
}
{
if (tree) {
rspamd_mempool_delete (tree->pool);
- g_slice_free1 (sizeof (*tree), tree);
+ g_free (tree);
}
}
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;
g_free (conn->hostname);
}
- g_slice_free1 (sizeof (*conn), conn);
+ g_free (conn);
}
}
{
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 ();
rspamd_mutex_free (st->m);
- g_slice_free1 (sizeof (struct lua_locked_state), st);
+ g_free (st);
}
gboolean
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);
}
else {
luaL_unref (L, LUA_REGISTRYINDEX, periodic->cbref);
- g_slice_free1 (sizeof (*periodic), periodic);
+ g_free (periodic);
}
}
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;
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);
{
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) {
}
}
- h->h = g_slice_alloc0 (sizeof (*h->h));
+ h->h = g_malloc0 (sizeof (*h->h));
rspamd_cryptobox_hash_init (h->h, NULL, 0);
ret:
}
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;
}
fann_destroy_train (cbdata->train);
luaL_unref (cbdata->L, LUA_REGISTRYINDEX, cbdata->cbref);
- g_slice_free1 (sizeof (*cbdata), cbdata);
+ g_free (cbdata);
}
static void *
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);
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
}
}
}
- 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);
lua_rawseti (L, -2, i + 1);
}
- g_slice_free1 (ninputs * sizeof (fann_type), cur_input);
+ g_free (cur_input);
}
else {
lua_pushnil (L);
rspamd_pubkey_unref (cbd->peer_pk);
}
- g_slice_free1 (sizeof (struct lua_http_cbdata), cbd);
+ g_free (cbd);
}
static void
return 1;
}
- cbd = g_slice_alloc0 (sizeof (*cbd));
+ cbd = g_malloc0 (sizeof (*cbd));
cbd->L = L;
cbd->cbref = cbref;
cbd->msg = msg;
{
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);
if (ip->addr) {
rspamd_inet_address_free (ip->addr);
}
- g_slice_free1 (sizeof (struct rspamd_lua_ip), ip);
+ g_free (ip);
}
return 0;
{
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);
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)) {
*pip = ip;
}
else {
- g_slice_free1 (sizeof (*ip), ip);
+ g_free (ip);
lua_pushnil (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);
cur = exceptions;
while (cur) {
ex = cur->data;
- g_slice_free1 (sizeof (*ex), ex);
+ g_free (ex);
cur = g_list_next (cur);
}
rspamd_ftok_t *val = v;
g_free ((gpointer)val->begin);
- g_slice_free1 (sizeof (*val), val);
+ g_free (val);
}
static void
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);
}
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;