aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 23:54:00 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 23:54:00 +0100
commita47922458216ce76eb5c591096cb8d4bd41f03c3 (patch)
treea5d5b79d030df2e012233999e614d0358f379053 /src/libutil/util.c
parentb2b9cfa6161a98d5d4d074573f99fdac6cb24556 (diff)
downloadrspamd-a47922458216ce76eb5c591096cb8d4bd41f03c3.tar.gz
rspamd-a47922458216ce76eb5c591096cb8d4bd41f03c3.zip
[Minor] Further g_slice cleanup
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r--src/libutil/util.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 7840dc744..fe092ad3c 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -1481,7 +1481,7 @@ rspamd_mutex_new (void)
{
rspamd_mutex_t *new;
- new = g_slice_alloc (sizeof (rspamd_mutex_t));
+ new = g_malloc0 (sizeof (rspamd_mutex_t));
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION > 30))
g_mutex_init (&new->mtx);
#else
@@ -1525,7 +1525,7 @@ rspamd_mutex_free (rspamd_mutex_t *mtx)
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION > 30))
g_mutex_clear (&mtx->mtx);
#endif
- g_slice_free1 (sizeof (rspamd_mutex_t), mtx);
+ g_free (mtx);
}
struct rspamd_thread_data {
@@ -1973,7 +1973,7 @@ rspamd_init_libs (void)
struct ottery_config *ottery_cfg;
gint ssl_options;
- ctx = g_slice_alloc0 (sizeof (*ctx));
+ ctx = g_malloc0 (sizeof (*ctx));
ctx->crypto_ctx = rspamd_cryptobox_init ();
ottery_cfg = g_malloc0 (ottery_get_sizeof_config ());
ottery_config_init (ottery_cfg);
@@ -2071,18 +2071,20 @@ rspamd_open_zstd_dictionary (const char *path)
{
struct zstd_dictionary *dict;
- dict = g_slice_alloc0 (sizeof (*dict));
+ dict = g_malloc0 (sizeof (*dict));
dict->dict = rspamd_file_xmap (path, PROT_READ, &dict->size, TRUE);
if (dict->dict == NULL) {
- g_slice_free1 (sizeof (*dict), dict);
+ g_free (dict);
+
return NULL;
}
dict->id = ZDICT_getDictID (dict->dict, dict->size);
if (dict->id == 0) {
- g_slice_free1 (sizeof (*dict), dict);
+ g_free (dict);
+
return NULL;
}
@@ -2094,7 +2096,7 @@ rspamd_free_zstd_dictionary (struct zstd_dictionary *dict)
{
if (dict) {
munmap (dict->dict, dict->size);
- g_slice_free1 (sizeof (*dict), dict);
+ g_free (dict);
}
}
@@ -2250,7 +2252,7 @@ rspamd_deinit_libs (struct rspamd_external_libs_ctx *ctx)
rspamd_free_zstd_dictionary (ctx->out_dict);
ZSTD_freeCStream (ctx->out_zstream);
ZSTD_freeDStream (ctx->in_zstream);
- g_slice_free1 (sizeof (*ctx), ctx);
+ g_free (ctx);
}
}