diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/rspamc.c | 4 | ||||
-rw-r--r-- | src/client/rspamdclient.c | 16 | ||||
-rw-r--r-- | src/libstat/backends/mmaped_file.c | 12 | ||||
-rw-r--r-- | src/libstat/backends/sqlite3_backend.c | 12 | ||||
-rw-r--r-- | src/libstat/learn_cache/redis_cache.c | 4 | ||||
-rw-r--r-- | src/libstat/learn_cache/sqlite3_cache.c | 6 | ||||
-rw-r--r-- | src/libutil/fstring.h | 4 | ||||
-rw-r--r-- | src/rspamadm/confighelp.c | 2 | ||||
-rw-r--r-- | src/rspamadm/fuzzy_merge.c | 14 | ||||
-rw-r--r-- | src/rspamadm/lua_repl.c | 8 |
10 files changed, 41 insertions, 41 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 08c23a1b8..bf13acc68 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -1572,7 +1572,7 @@ rspamc_client_cb (struct rspamd_client_connection *conn, rspamd_client_destroy (conn); g_free (cbdata->filename); - g_slice_free1 (sizeof (struct rspamc_callback_data), cbdata); + g_free (cbdata); } static void @@ -1623,7 +1623,7 @@ rspamc_process_input (struct event_base *ev_base, struct rspamc_command *cmd, conn = rspamd_client_init (ev_base, hostbuf, port, timeout, key); if (conn != NULL) { - cbdata = g_slice_alloc (sizeof (struct rspamc_callback_data)); + cbdata = g_malloc0 (sizeof (struct rspamc_callback_data)); cbdata->cmd = cmd; cbdata->filename = g_strdup (name); diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c index 4a58b3628..ad801c182 100644 --- a/src/client/rspamdclient.c +++ b/src/client/rspamdclient.c @@ -73,7 +73,7 @@ rspamd_client_request_free (struct rspamd_client_request *req) g_string_free (req->input, TRUE); } - g_slice_free1 (sizeof (*req), req); + g_free (req); } } @@ -252,7 +252,7 @@ rspamd_client_init (struct event_base *ev_base, const gchar *name, return NULL; } - conn = g_slice_alloc0 (sizeof (struct rspamd_client_connection)); + conn = g_malloc0 (sizeof (struct rspamd_client_connection)); conn->ev_base = ev_base; conn->fd = fd; conn->req_sent = FALSE; @@ -310,7 +310,7 @@ rspamd_client_command (struct rspamd_client_connection *conn, void *dict = NULL; ZSTD_CCtx *zctx; - req = g_slice_alloc0 (sizeof (struct rspamd_client_request)); + req = g_malloc0 (sizeof (struct rspamd_client_request)); req->conn = conn; req->cb = cb; req->ud = ud; @@ -342,7 +342,7 @@ rspamd_client_command (struct rspamd_client_connection *conn, if (ferror (in) != 0) { g_set_error (err, RCLIENT_ERROR, ferror ( in), "input IO error: %s", strerror (ferror (in))); - g_slice_free1 (sizeof (struct rspamd_client_request), req); + g_free (req); g_string_free (input, TRUE); return FALSE; } @@ -360,7 +360,7 @@ rspamd_client_command (struct rspamd_client_connection *conn, "cannot open dictionary %s: %s", comp_dictionary, strerror (errno)); - g_slice_free1 (sizeof (struct rspamd_client_request), req); + g_free (req); g_string_free (input, TRUE); return FALSE; @@ -373,7 +373,7 @@ rspamd_client_command (struct rspamd_client_connection *conn, "cannot open dictionary %s: %s", comp_dictionary, strerror (errno)); - g_slice_free1 (sizeof (struct rspamd_client_request), req); + g_free (req); g_string_free (input, TRUE); munmap (dict, dict_len); @@ -393,7 +393,7 @@ rspamd_client_command (struct rspamd_client_connection *conn, if (ZSTD_isError (body->len)) { g_set_error (err, RCLIENT_ERROR, ferror ( in), "compression error"); - g_slice_free1 (sizeof (struct rspamd_client_request), req); + g_free (req); g_string_free (input, TRUE); rspamd_fstring_free (body); ZSTD_freeCCtx (zctx); @@ -466,6 +466,6 @@ rspamd_client_destroy (struct rspamd_client_connection *conn) rspamd_keypair_unref (conn->keypair); } g_string_free (conn->server_name, TRUE); - g_slice_free1 (sizeof (struct rspamd_client_connection), conn); + g_free (conn); } } diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c index 65ccb5aa1..b3861ca96 100644 --- a/src/libstat/backends/mmaped_file.c +++ b/src/libstat/backends/mmaped_file.c @@ -597,13 +597,13 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, size); } - new_file = g_slice_alloc0 (sizeof (rspamd_mmaped_file_t)); + new_file = g_malloc0 (sizeof (rspamd_mmaped_file_t)); if ((new_file->fd = open (filename, O_RDWR)) == -1) { msg_info_pool ("cannot open file %s, error %d, %s", filename, errno, strerror (errno)); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -615,7 +615,7 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, filename, errno, strerror (errno)); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -632,7 +632,7 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, filename, errno, strerror (errno)); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -640,7 +640,7 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, close (new_file->fd); rspamd_file_unlock (new_file->fd, FALSE); munmap (new_file->map, st.st_size); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -669,7 +669,7 @@ rspamd_mmaped_file_close_file (rspamd_mempool_t *pool, close (file->fd); } - g_slice_free1 (sizeof (*file), file); + g_free (file); return 0; } diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index ec47b06a9..6563d0dc1 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -437,13 +437,13 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, .tv_nsec = 1000000 }; - bk = g_slice_alloc0 (sizeof (*bk)); + bk = g_malloc0 (sizeof (*bk)); bk->sqlite = rspamd_sqlite3_open_or_create (pool, path, create_tables_sql, 0, err); bk->pool = pool; if (bk->sqlite == NULL) { - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); return NULL; } @@ -455,7 +455,7 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, if (bk->prstmt == NULL) { sqlite3_close (bk->sqlite); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); return NULL; } @@ -472,7 +472,7 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, msg_err_pool ("failed to stard transaction: %d, %s", ret, sqlite3_errmsg (bk->sqlite)); sqlite3_close (bk->sqlite); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); return NULL; } @@ -496,7 +496,7 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, (gint64)strlen (tok_conf_encoded), tok_conf_encoded) != SQLITE_OK) { sqlite3_close (bk->sqlite); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); g_free (tok_conf_encoded); return NULL; @@ -642,7 +642,7 @@ rspamd_sqlite3_close (gpointer p) rspamd_sqlite3_close_prstmt (bk->sqlite, bk->prstmt); sqlite3_close (bk->sqlite); g_free (bk->fname); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); } } diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c index 14a90b9d1..b7ba71f4b 100644 --- a/src/libstat/learn_cache/redis_cache.c +++ b/src/libstat/learn_cache/redis_cache.c @@ -302,7 +302,7 @@ rspamd_stat_cache_redis_init (struct rspamd_stat_ctx *ctx, const ucl_object_t *obj; gboolean ret = FALSE; - cache_ctx = g_slice_alloc0 (sizeof (*cache_ctx)); + cache_ctx = g_malloc0 (sizeof (*cache_ctx)); /* First search in backend configuration */ obj = ucl_object_lookup (st->classifier->cfg->opts, "backend"); @@ -344,7 +344,7 @@ rspamd_stat_cache_redis_init (struct rspamd_stat_ctx *ctx, if (!ret) { msg_err_config ("cannot init redis cache for %s", stf->symbol); - g_slice_free1 (sizeof (*cache_ctx), cache_ctx); + g_free (cache_ctx); return NULL; } diff --git a/src/libstat/learn_cache/sqlite3_cache.c b/src/libstat/learn_cache/sqlite3_cache.c index 055950cf4..255c835bb 100644 --- a/src/libstat/learn_cache/sqlite3_cache.c +++ b/src/libstat/learn_cache/sqlite3_cache.c @@ -143,7 +143,7 @@ rspamd_stat_cache_sqlite3_init (struct rspamd_stat_ctx *ctx, err = NULL; } else { - new = g_slice_alloc (sizeof (*new)); + new = g_malloc0 (sizeof (*new)); new->db = sqlite; new->prstmt = rspamd_sqlite3_init_prstmt (sqlite, prepared_stmts, RSPAMD_STAT_CACHE_MAX, &err); @@ -153,7 +153,7 @@ rspamd_stat_cache_sqlite3_init (struct rspamd_stat_ctx *ctx, g_error_free (err); err = NULL; sqlite3_close (sqlite); - g_slice_free1 (sizeof (*new), new); + g_free (new); new = NULL; } } @@ -285,7 +285,7 @@ rspamd_stat_cache_sqlite3_close (gpointer c) if (ctx != NULL) { rspamd_sqlite3_close_prstmt (ctx->db, ctx->prstmt); sqlite3_close (ctx->db); - g_slice_free1 (sizeof (*ctx), ctx); + g_free (ctx); } } diff --git a/src/libutil/fstring.h b/src/libutil/fstring.h index 1d1d3b137..e83c44a1c 100644 --- a/src/libutil/fstring.h +++ b/src/libutil/fstring.h @@ -137,12 +137,12 @@ gboolean rspamd_ftok_cstr_equal (const rspamd_ftok_t *s, * | len | allocated | <data> -- fstring_t * <begin> -- tok * - * tok is expected to be allocated with g_slice_alloc + * tok is expected to be allocated with g_malloc */ void rspamd_fstring_mapped_ftok_free (gpointer p); /** - * Map token to a specified string. Token must be freed using g_slice_free1 + * Map token to a specified string. Token must be freed using g_free */ rspamd_ftok_t *rspamd_ftok_map (const rspamd_fstring_t *s); diff --git a/src/rspamadm/confighelp.c b/src/rspamadm/confighelp.c index 26251937e..a64afe4b0 100644 --- a/src/rspamadm/confighelp.c +++ b/src/rspamadm/confighelp.c @@ -235,7 +235,7 @@ rspamadm_confighelp (gint argc, gchar **argv) /* Init modules to get documentation strings */ for (pmod = cfg->compiled_modules; pmod != NULL && *pmod != NULL; pmod++) { mod = *pmod; - mod_ctx = g_slice_alloc0 (sizeof (struct module_ctx)); + mod_ctx = g_malloc0 (sizeof (struct module_ctx)); if (mod->module_init_func (cfg, &mod_ctx) == 0) { g_hash_table_insert (cfg->c_modules, diff --git a/src/rspamadm/fuzzy_merge.c b/src/rspamadm/fuzzy_merge.c index 92a434064..c286bffa9 100644 --- a/src/rspamadm/fuzzy_merge.c +++ b/src/rspamadm/fuzzy_merge.c @@ -332,7 +332,7 @@ rspamadm_fuzzy_merge (gint argc, gchar **argv) * local one then we replace dest value with the src value */ if (src_value > value && src_flag == flag) { - nop = g_slice_alloc (sizeof (*nop)); + nop = g_malloc0 (sizeof (*nop)); nop->op = OP_UPDATE; memcpy (nop->digest, digest, sizeof (nop->digest)); @@ -355,7 +355,7 @@ rspamadm_fuzzy_merge (gint argc, gchar **argv) else { ndup_other ++; } - g_slice_free1 (sizeof (*nop), nop); + g_free (nop); } } else { @@ -366,7 +366,7 @@ rspamadm_fuzzy_merge (gint argc, gchar **argv) /* Digest has not been found, but maybe we have the same in other * sources ? */ - nop = g_slice_alloc (sizeof (*nop)); + nop = g_malloc0 (sizeof (*nop)); nop->op = OP_INSERT; memcpy (nop->digest, digest, sizeof (nop->digest)); @@ -393,7 +393,7 @@ rspamadm_fuzzy_merge (gint argc, gchar **argv) else { ndup_other++; } - g_slice_free1 (sizeof (*nop), nop); + g_free (nop); } } } @@ -414,7 +414,7 @@ rspamadm_fuzzy_merge (gint argc, gchar **argv) if ((op = g_hash_table_lookup (digests_id, &id)) != NULL) { /* value, number, digest_id */ - nop = g_slice_alloc (sizeof (*nop)); + nop = g_malloc0 (sizeof (*nop)); nop->op = OP_INSERT_SHINGLE; memcpy (nop->digest, op->digest, sizeof (nop->digest)); nop->data.shgl.number = sqlite3_column_int64 (shgl_stmt, 1); @@ -547,7 +547,7 @@ rspamadm_fuzzy_merge (gint argc, gchar **argv) sqlite3_close (dest_db); for (i = 0; i < ops->len; i++) { op = g_ptr_array_index (ops, i); - g_slice_free1 (sizeof (*op), op); + g_free (op); } g_ptr_array_free (ops, TRUE); rspamd_mempool_delete (pool); @@ -572,7 +572,7 @@ err: sqlite3_close (dest_db); for (i = 0; i < ops->len; i++) { op = g_ptr_array_index (ops, i); - g_slice_free1 (sizeof (*op), op); + g_free (op); } g_ptr_array_free (ops, TRUE); rspamd_mempool_delete (pool); diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c index 96b6940ae..f959c6bf3 100644 --- a/src/rspamadm/lua_repl.c +++ b/src/rspamadm/lua_repl.c @@ -548,7 +548,7 @@ rspamadm_lua_accept_cb (gint fd, short what, void *arg) return; } - session = g_slice_alloc0 (sizeof (*session)); + session = g_malloc0 (sizeof (*session)); session->rt = ctx->rt; session->ctx = ctx; session->addr = addr; @@ -571,7 +571,7 @@ rspamadm_lua_finish_handler (struct rspamd_http_connection_entry *conn_ent) { struct rspamadm_lua_repl_session *session = conn_ent->ud; - g_slice_free1 (sizeof (*session), session); + g_free (session); } /* @@ -740,7 +740,7 @@ rspamadm_lua (gint argc, gchar **argv) } ev_base = event_init (); - ctx = g_slice_alloc0 (sizeof (*ctx)); + ctx = g_malloc0 (sizeof (*ctx)); http = rspamd_http_router_new (rspamadm_lua_error_handler, rspamadm_lua_finish_handler, NULL, ev_base, @@ -758,7 +758,7 @@ rspamadm_lua (gint argc, gchar **argv) if (fd != -1) { struct event *ev; - ev = g_slice_alloc0 (sizeof (*ev)); + ev = g_malloc0 (sizeof (*ev)); event_set (ev, fd, EV_READ|EV_PERSIST, rspamadm_lua_accept_cb, ctx); event_base_set (ev_base, ev); |