Stop using GSlice

GLib is discussing deprecating/removing it upstream [1] since it has
only limited uses. Next to that, it seems to bork stack traces here when
using ASAN (for which you also have to specify `G_SLICE=always-malloc`
and some other envvars too).

In other words, let's just get rid of using `GSlice` and call the
allocation APIs directly.

[1]: https://gitlab.gnome.org/GNOME/glib/-/issues/1079
This commit is contained in:
Niels De Graef 2023-01-16 19:15:20 +01:00
parent 33a4de59a2
commit 0f04e5d371
11 changed files with 58 additions and 58 deletions

View File

@ -740,7 +740,7 @@ items_closure_free (gpointer data)
{ {
ItemsClosure *closure = data; ItemsClosure *closure = data;
g_hash_table_unref (closure->items); g_hash_table_unref (closure->items);
g_slice_free (ItemsClosure, closure); g_free (closure);
} }
static void static void
@ -816,7 +816,7 @@ secret_collection_load_items (SecretCollection *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_collection_load_items); g_task_set_source_tag (task, secret_collection_load_items);
closure = g_slice_new0 (ItemsClosure); closure = g_new0 (ItemsClosure, 1);
closure->items = items_table_new (); closure->items = items_table_new ();
g_task_set_task_data (task, closure, items_closure_free); g_task_set_task_data (task, closure, items_closure_free);
@ -973,7 +973,7 @@ create_closure_free (gpointer data)
g_clear_object (&closure->collection); g_clear_object (&closure->collection);
g_hash_table_unref (closure->properties); g_hash_table_unref (closure->properties);
g_free (closure->alias); g_free (closure->alias);
g_slice_free (CreateClosure, closure); g_free (closure);
} }
static void static void
@ -1103,7 +1103,7 @@ secret_collection_create (SecretService *service,
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_collection_create); g_task_set_source_tag (task, secret_collection_create);
closure = g_slice_new0 (CreateClosure); closure = g_new0 (CreateClosure, 1);
closure->properties = _secret_collection_properties_new (label); closure->properties = _secret_collection_properties_new (label);
closure->alias = g_strdup (alias); closure->alias = g_strdup (alias);
closure->flags = flags; closure->flags = flags;
@ -1240,7 +1240,7 @@ search_closure_free (gpointer data)
g_object_unref (closure->collection); g_object_unref (closure->collection);
g_hash_table_unref (closure->items); g_hash_table_unref (closure->items);
g_strfreev (closure->paths); g_strfreev (closure->paths);
g_slice_free (SearchClosure, closure); g_free (closure);
} }
static void static void
@ -1444,7 +1444,7 @@ secret_collection_search (SecretCollection *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_collection_search); g_task_set_source_tag (task, secret_collection_search);
search = g_slice_new0 (SearchClosure); search = g_new0 (SearchClosure, 1);
search->collection = g_object_ref (self); search->collection = g_object_ref (self);
search->items = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); search->items = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
search->flags = flags; search->flags = flags;
@ -2013,7 +2013,7 @@ read_closure_free (gpointer data)
{ {
ReadClosure *read = data; ReadClosure *read = data;
g_free (read->alias); g_free (read->alias);
g_slice_free (ReadClosure, read); g_free (read);
} }
static void static void
@ -2141,7 +2141,7 @@ secret_collection_for_alias (SecretService *service,
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_collection_for_alias); g_task_set_source_tag (task, secret_collection_for_alias);
read = g_slice_new0 (ReadClosure); read = g_new0 (ReadClosure, 1);
read->alias = g_strdup (alias); read->alias = g_strdup (alias);
read->flags = flags; read->flags = flags;
g_task_set_task_data (task, read, read_closure_free); g_task_set_task_data (task, read, read_closure_free);

View File

@ -218,7 +218,7 @@ init_closure_free (gpointer data)
g_clear_pointer (&init->buffer, egg_secure_free); g_clear_pointer (&init->buffer, egg_secure_free);
g_clear_object (&init->connection); g_clear_object (&init->connection);
g_clear_pointer (&init->request_path, g_free); g_clear_pointer (&init->request_path, g_free);
g_slice_free (InitClosure, init); g_free (init);
} }
#define PASSWORD_SIZE 64 #define PASSWORD_SIZE 64
@ -572,7 +572,7 @@ secret_file_backend_real_init_async (GAsyncInitable *initable,
g_object_unref (file); g_object_unref (file);
secret_value_unref (password); secret_value_unref (password);
} else if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS) || g_getenv ("SNAP_NAME") != NULL) { } else if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS) || g_getenv ("SNAP_NAME") != NULL) {
init = g_slice_new0 (InitClosure); init = g_new0 (InitClosure, 1);
init->io_priority = io_priority; init->io_priority = io_priority;
init->file = file; init->file = file;
g_task_set_task_data (task, init, init_closure_free); g_task_set_task_data (task, init, init_closure_free);

View File

@ -1341,7 +1341,7 @@ loads_closure_free (gpointer data)
if (loads->service) if (loads->service)
g_object_unref (loads->service); g_object_unref (loads->service);
g_hash_table_destroy (loads->items); g_hash_table_destroy (loads->items);
g_slice_free (LoadsClosure, loads); g_free (loads);
} }
static void static void
@ -1443,7 +1443,7 @@ secret_item_load_secrets (GList *items,
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_item_load_secrets); g_task_set_source_tag (task, secret_item_load_secrets);
loads = g_slice_new0 (LoadsClosure); loads = g_new0 (LoadsClosure, 1);
loads->items = g_hash_table_new_full (g_str_hash, g_str_equal, loads->items = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_object_unref); g_free, g_object_unref);

View File

@ -55,7 +55,7 @@ search_closure_free (gpointer data)
g_variant_unref (closure->attributes); g_variant_unref (closure->attributes);
g_strfreev (closure->unlocked); g_strfreev (closure->unlocked);
g_strfreev (closure->locked); g_strfreev (closure->locked);
g_slice_free (SearchClosure, closure); g_free (closure);
} }
static void static void
@ -317,7 +317,7 @@ secret_service_search (SecretService *service,
task = g_task_new (service, cancellable, callback, user_data); task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_search); g_task_set_source_tag (task, secret_service_search);
closure = g_slice_new0 (SearchClosure); closure = g_new0 (SearchClosure, 1);
closure->items = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); closure->items = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
closure->flags = flags; closure->flags = flags;
closure->attributes = _secret_attributes_to_variant (attributes, schema_name); closure->attributes = _secret_attributes_to_variant (attributes, schema_name);
@ -583,7 +583,7 @@ xlock_closure_free (gpointer data)
g_ptr_array_free (closure->paths, TRUE); g_ptr_array_free (closure->paths, TRUE);
g_strfreev (closure->xlocked); g_strfreev (closure->xlocked);
g_hash_table_unref (closure->objects); g_hash_table_unref (closure->objects);
g_slice_free (XlockClosure, closure); g_free (closure);
} }
static void static void
@ -667,7 +667,7 @@ service_xlock_async (SecretService *service,
task = g_task_new (service, cancellable, callback, user_data); task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, service_xlock_async); g_task_set_source_tag (task, service_xlock_async);
xlock = g_slice_new0 (XlockClosure); xlock = g_new0 (XlockClosure, 1);
xlock->objects = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); xlock->objects = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
xlock->locking = locking; xlock->locking = locking;
xlock->paths = g_ptr_array_new (); xlock->paths = g_ptr_array_new ();
@ -969,7 +969,7 @@ store_closure_free (gpointer data)
g_free (store->collection_path); g_free (store->collection_path);
secret_value_unref (store->value); secret_value_unref (store->value);
g_hash_table_unref (store->properties); g_hash_table_unref (store->properties);
g_slice_free (StoreClosure, store); g_free (store);
} }
static void static void
@ -1172,7 +1172,7 @@ secret_service_store (SecretService *service,
task = g_task_new (service, cancellable, callback, user_data); task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_store); g_task_set_source_tag (task, secret_service_store);
store = g_slice_new0 (StoreClosure); store = g_new0 (StoreClosure, 1);
store->collection_path = _secret_util_collection_to_path (collection); store->collection_path = _secret_util_collection_to_path (collection);
store->value = secret_value_ref (value); store->value = secret_value_ref (value);
store->properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, store->properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
@ -1581,7 +1581,7 @@ delete_closure_free (gpointer data)
if (closure->service) if (closure->service)
g_object_unref (closure->service); g_object_unref (closure->service);
g_variant_unref (closure->attributes); g_variant_unref (closure->attributes);
g_slice_free (DeleteClosure, closure); g_free (closure);
} }
static void static void
@ -1708,7 +1708,7 @@ secret_service_clear (SecretService *service,
task = g_task_new (service, cancellable, callback, user_data); task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_clear); g_task_set_source_tag (task, secret_service_clear);
closure = g_slice_new0 (DeleteClosure); closure = g_new0 (DeleteClosure, 1);
closure->attributes = _secret_attributes_to_variant (attributes, schema_name); closure->attributes = _secret_attributes_to_variant (attributes, schema_name);
g_variant_ref_sink (closure->attributes); g_variant_ref_sink (closure->attributes);
g_task_set_task_data (task, closure, delete_closure_free); g_task_set_task_data (task, closure, delete_closure_free);
@ -1822,7 +1822,7 @@ set_closure_free (gpointer data)
SetClosure *set = data; SetClosure *set = data;
g_free (set->alias); g_free (set->alias);
g_free (set->collection_path); g_free (set->collection_path);
g_slice_free (SetClosure, set); g_free (set);
} }
static void static void
@ -1907,7 +1907,7 @@ secret_service_set_alias (SecretService *service,
task = g_task_new (service, cancellable, callback, user_data); task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_set_alias); g_task_set_source_tag (task, secret_service_set_alias);
set = g_slice_new0 (SetClosure); set = g_new0 (SetClosure, 1);
set->alias = g_strdup (alias); set->alias = g_strdup (alias);
if (collection) { if (collection) {

View File

@ -100,7 +100,7 @@ store_closure_free (gpointer data)
g_free (store->collection); g_free (store->collection);
g_free (store->label); g_free (store->label);
secret_value_unref (store->value); secret_value_unref (store->value);
g_slice_free (StoreClosure, store); g_free (store);
} }
static void static void
@ -202,7 +202,7 @@ secret_password_storev (const SecretSchema *schema,
return; return;
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
store = g_slice_new0 (StoreClosure); store = g_new0 (StoreClosure, 1);
store->schema = _secret_schema_ref_if_nonstatic (schema); store->schema = _secret_schema_ref_if_nonstatic (schema);
store->attributes = g_hash_table_ref (attributes); store->attributes = g_hash_table_ref (attributes);
store->collection = g_strdup (collection); store->collection = g_strdup (collection);
@ -312,7 +312,7 @@ secret_password_storev_binary (const SecretSchema *schema,
return; return;
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
store = g_slice_new0 (StoreClosure); store = g_new0 (StoreClosure, 1);
store->schema = _secret_schema_ref_if_nonstatic (schema); store->schema = _secret_schema_ref_if_nonstatic (schema);
store->attributes = g_hash_table_ref (attributes); store->attributes = g_hash_table_ref (attributes);
store->collection = g_strdup (collection); store->collection = g_strdup (collection);
@ -648,7 +648,7 @@ lookup_closure_free (gpointer data)
LookupClosure *closure = data; LookupClosure *closure = data;
_secret_schema_unref_if_nonstatic (closure->schema); _secret_schema_unref_if_nonstatic (closure->schema);
g_hash_table_unref (closure->attributes); g_hash_table_unref (closure->attributes);
g_slice_free (LookupClosure, closure); g_free (closure);
} }
static void static void
@ -740,7 +740,7 @@ secret_password_lookupv (const SecretSchema *schema,
return; return;
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
lookup = g_slice_new0 (LookupClosure); lookup = g_new0 (LookupClosure, 1);
lookup->schema = _secret_schema_ref_if_nonstatic (schema); lookup->schema = _secret_schema_ref_if_nonstatic (schema);
lookup->attributes = g_hash_table_ref (attributes); lookup->attributes = g_hash_table_ref (attributes);
g_task_set_task_data (task, lookup, lookup_closure_free); g_task_set_task_data (task, lookup, lookup_closure_free);
@ -1192,7 +1192,7 @@ clear_closure_free (gpointer data)
ClearClosure *closure = data; ClearClosure *closure = data;
_secret_schema_unref_if_nonstatic (closure->schema); _secret_schema_unref_if_nonstatic (closure->schema);
g_hash_table_unref (closure->attributes); g_hash_table_unref (closure->attributes);
g_slice_free (ClearClosure, closure); g_free (closure);
} }
static void static void
@ -1282,7 +1282,7 @@ secret_password_clearv (const SecretSchema *schema,
return; return;
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
clear = g_slice_new0 (ClearClosure); clear = g_new0 (ClearClosure, 1);
clear->schema = _secret_schema_ref_if_nonstatic (schema); clear->schema = _secret_schema_ref_if_nonstatic (schema);
clear->attributes = g_hash_table_ref (attributes); clear->attributes = g_hash_table_ref (attributes);
g_task_set_task_data (task, clear, clear_closure_free); g_task_set_task_data (task, clear, clear_closure_free);
@ -1474,7 +1474,7 @@ search_closure_free (gpointer data)
SearchClosure *closure = data; SearchClosure *closure = data;
_secret_schema_unref_if_nonstatic (closure->schema); _secret_schema_unref_if_nonstatic (closure->schema);
g_hash_table_unref (closure->attributes); g_hash_table_unref (closure->attributes);
g_slice_free (SearchClosure, closure); g_free (closure);
} }
static void static void
@ -1573,7 +1573,7 @@ secret_password_searchv (const SecretSchema *schema,
return; return;
task = g_task_new (NULL, cancellable, callback, user_data); task = g_task_new (NULL, cancellable, callback, user_data);
search = g_slice_new0 (SearchClosure); search = g_new0 (SearchClosure, 1);
search->schema = _secret_schema_ref_if_nonstatic (schema); search->schema = _secret_schema_ref_if_nonstatic (schema);
search->attributes = g_hash_table_ref (attributes); search->attributes = g_hash_table_ref (attributes);
search->flags = flags; search->flags = flags;

View File

@ -1000,7 +1000,7 @@ xlock_closure_free (gpointer data)
{ {
XlockClosure *closure = data; XlockClosure *closure = data;
g_clear_object (&closure->prompt); g_clear_object (&closure->prompt);
g_slice_free (XlockClosure, closure); g_free (closure);
} }
static void static void
@ -1095,7 +1095,7 @@ _secret_service_xlock_paths_async (SecretService *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, _secret_service_xlock_paths_async); g_task_set_source_tag (task, _secret_service_xlock_paths_async);
closure = g_slice_new0 (XlockClosure); closure = g_new0 (XlockClosure, 1);
g_task_set_task_data (task, closure, xlock_closure_free); g_task_set_task_data (task, closure, xlock_closure_free);
g_dbus_proxy_call (G_DBUS_PROXY (self), method, g_dbus_proxy_call (G_DBUS_PROXY (self), method,
@ -1406,7 +1406,7 @@ delete_closure_free (gpointer data)
{ {
DeleteClosure *closure = data; DeleteClosure *closure = data;
g_clear_object (&closure->prompt); g_clear_object (&closure->prompt);
g_slice_free (DeleteClosure, closure); g_free (closure);
} }
static void static void
@ -1486,7 +1486,7 @@ _secret_service_delete_path (SecretService *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, _secret_service_delete_path); g_task_set_source_tag (task, _secret_service_delete_path);
closure = g_slice_new0 (DeleteClosure); closure = g_new0 (DeleteClosure, 1);
g_task_set_task_data (task, closure, delete_closure_free); g_task_set_task_data (task, closure, delete_closure_free);
g_dbus_connection_call (g_dbus_proxy_get_connection (G_DBUS_PROXY (self)), g_dbus_connection_call (g_dbus_proxy_get_connection (G_DBUS_PROXY (self)),
@ -1630,7 +1630,7 @@ collection_closure_free (gpointer data)
{ {
CollectionClosure *closure = data; CollectionClosure *closure = data;
g_clear_object (&closure->prompt); g_clear_object (&closure->prompt);
g_slice_free (CollectionClosure, closure); g_free (closure);
} }
static void static void
@ -1753,7 +1753,7 @@ secret_service_create_collection_dbus_path (SecretService *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_create_collection_dbus_path); g_task_set_source_tag (task, secret_service_create_collection_dbus_path);
closure = g_slice_new0 (CollectionClosure); closure = g_new0 (CollectionClosure, 1);
g_task_set_task_data (task, closure, collection_closure_free); g_task_set_task_data (task, closure, collection_closure_free);
props = _secret_util_variant_for_properties (properties); props = _secret_util_variant_for_properties (properties);
@ -1894,7 +1894,7 @@ item_closure_free (gpointer data)
secret_value_unref (closure->value); secret_value_unref (closure->value);
g_free (closure->collection_path); g_free (closure->collection_path);
g_clear_object (&closure->prompt); g_clear_object (&closure->prompt);
g_slice_free (ItemClosure, closure); g_free (closure);
} }
static void static void
@ -2049,7 +2049,7 @@ secret_service_create_item_dbus_path (SecretService *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_create_item_dbus_path); g_task_set_source_tag (task, secret_service_create_item_dbus_path);
closure = g_slice_new0 (ItemClosure); closure = g_new0 (ItemClosure, 1);
closure->properties = _secret_util_variant_for_properties (properties); closure->properties = _secret_util_variant_for_properties (properties);
g_variant_ref_sink (closure->properties); g_variant_ref_sink (closure->properties);
closure->replace = flags & SECRET_ITEM_CREATE_REPLACE; closure->replace = flags & SECRET_ITEM_CREATE_REPLACE;

View File

@ -251,7 +251,7 @@ perform_closure_free (gpointer data)
g_variant_type_free (closure->return_type); g_variant_type_free (closure->return_type);
g_assert (closure->signal == 0); g_assert (closure->signal == 0);
g_assert (closure->watch == 0); g_assert (closure->watch == 0);
g_slice_free (PerformClosure, closure); g_free (closure);
} }
static void static void
@ -446,7 +446,7 @@ secret_prompt_perform (SecretPrompt *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
async_cancellable = g_task_get_cancellable (task); async_cancellable = g_task_get_cancellable (task);
g_task_set_source_tag (task, secret_prompt_perform); g_task_set_source_tag (task, secret_prompt_perform);
closure = g_slice_new0 (PerformClosure); closure = g_new0 (PerformClosure, 1);
closure->connection = g_object_ref (g_dbus_proxy_get_connection (proxy)); closure->connection = g_object_ref (g_dbus_proxy_get_connection (proxy));
closure->call_cancellable = g_cancellable_new (); closure->call_cancellable = g_cancellable_new ();
async_cancellable = cancellable ? g_object_ref (cancellable) : NULL; async_cancellable = cancellable ? g_object_ref (cancellable) : NULL;

View File

@ -120,7 +120,7 @@ schema_attribute_copy (SecretSchemaAttribute *attribute)
{ {
SecretSchemaAttribute *copy; SecretSchemaAttribute *copy;
copy = g_slice_new0 (SecretSchemaAttribute); copy = g_new0 (SecretSchemaAttribute, 1);
copy->name = g_strdup (attribute->name); copy->name = g_strdup (attribute->name);
copy->type = attribute->type; copy->type = attribute->type;
@ -131,7 +131,7 @@ static void
schema_attribute_free (SecretSchemaAttribute *attribute) schema_attribute_free (SecretSchemaAttribute *attribute)
{ {
g_free ((gchar *)attribute->name); g_free ((gchar *)attribute->name);
g_slice_free (SecretSchemaAttribute, attribute); g_free (attribute);
} }
G_DEFINE_BOXED_TYPE (SecretSchemaAttribute, secret_schema_attribute, G_DEFINE_BOXED_TYPE (SecretSchemaAttribute, secret_schema_attribute,
@ -184,7 +184,7 @@ secret_schema_newv (const gchar *name,
g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (attribute_names_and_types != NULL, NULL); g_return_val_if_fail (attribute_names_and_types != NULL, NULL);
schema = g_slice_new0 (SecretSchema); schema = g_new0 (SecretSchema, 1);
schema->name = g_strdup (name); schema->name = g_strdup (name);
schema->flags = flags; schema->flags = flags;
schema->reserved = 1; schema->reserved = 1;
@ -308,7 +308,7 @@ secret_schema_ref (SecretSchema *schema)
g_atomic_int_inc (&schema->reserved); g_atomic_int_inc (&schema->reserved);
result = schema; result = schema;
} else { } else {
result = g_slice_new0 (SecretSchema); result = g_new0 (SecretSchema, 1);
result->reserved = 1; result->reserved = 1;
result->name = g_strdup (schema->name); result->name = g_strdup (schema->name);
@ -354,7 +354,7 @@ secret_schema_unref (SecretSchema *schema)
g_free ((gpointer)schema->name); g_free ((gpointer)schema->name);
for (i = 0; i < G_N_ELEMENTS (schema->attributes); i++) for (i = 0; i < G_N_ELEMENTS (schema->attributes); i++)
g_free ((gpointer)schema->attributes[i].name); g_free ((gpointer)schema->attributes[i].name);
g_slice_free (SecretSchema, schema); g_free (schema);
} }
} }

View File

@ -610,7 +610,7 @@ static void
init_closure_free (gpointer data) init_closure_free (gpointer data)
{ {
InitClosure *closure = data; InitClosure *closure = data;
g_slice_free (InitClosure, closure); g_free (closure);
} }
static gboolean static gboolean
@ -744,7 +744,7 @@ on_init_base (GObject *source,
task = g_task_new (source, cancellable, base->callback, base->user_data); task = g_task_new (source, cancellable, base->callback, base->user_data);
g_task_set_source_tag (task, secret_service_async_initable_init_async); g_task_set_source_tag (task, secret_service_async_initable_init_async);
init = g_slice_new0 (InitClosure); init = g_new0 (InitClosure, 1);
g_task_set_task_data (task, init, init_closure_free); g_task_set_task_data (task, init, init_closure_free);
g_clear_object (&base_task); g_clear_object (&base_task);
@ -822,7 +822,7 @@ secret_service_real_ensure_for_flags (SecretBackend *self,
g_return_if_fail (SECRET_IS_SERVICE (self)); g_return_if_fail (SECRET_IS_SERVICE (self));
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
closure = g_slice_new0 (InitClosure); closure = g_new0 (InitClosure, 1);
g_task_set_task_data (task, closure, init_closure_free); g_task_set_task_data (task, closure, init_closure_free);
service_ensure_for_flags_async (SECRET_SERVICE (self), flags, task); service_ensure_for_flags_async (SECRET_SERVICE (self), flags, task);
g_object_unref (task); g_object_unref (task);
@ -1004,7 +1004,7 @@ secret_service_get (SecretServiceFlags flags,
} else { } else {
task = g_task_new (service, cancellable, callback, user_data); task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_get); g_task_set_source_tag (task, secret_service_get);
closure = g_slice_new0 (InitClosure); closure = g_new0 (InitClosure, 1);
closure->flags = flags; closure->flags = flags;
g_task_set_task_data (task, closure, init_closure_free); g_task_set_task_data (task, closure, init_closure_free);
@ -1620,7 +1620,7 @@ ensure_closure_free (gpointer data)
{ {
EnsureClosure *closure = data; EnsureClosure *closure = data;
g_hash_table_unref (closure->collections); g_hash_table_unref (closure->collections);
g_slice_free (EnsureClosure, closure); g_free (closure);
} }
static void static void
@ -1695,7 +1695,7 @@ secret_service_load_collections (SecretService *self,
task = g_task_new (self, cancellable, callback, user_data); task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, secret_service_load_collections); g_task_set_source_tag (task, secret_service_load_collections);
closure = g_slice_new0 (EnsureClosure); closure = g_new0 (EnsureClosure, 1);
closure->collections = collections_table_new (); closure->collections = collections_table_new ();
g_task_set_task_data (task, closure, ensure_closure_free); g_task_set_task_data (task, closure, ensure_closure_free);

View File

@ -271,7 +271,7 @@ set_closure_free (gpointer data)
SetClosure *closure = data; SetClosure *closure = data;
g_free (closure->property); g_free (closure->property);
g_variant_unref (closure->value); g_variant_unref (closure->value);
g_slice_free (SetClosure, closure); g_free (closure);
} }
static void static void
@ -320,7 +320,7 @@ _secret_util_set_property (GDBusProxy *proxy,
task = g_task_new (proxy, cancellable, callback, user_data); task = g_task_new (proxy, cancellable, callback, user_data);
g_task_set_source_tag (task, result_tag); g_task_set_source_tag (task, result_tag);
closure = g_slice_new0 (SetClosure); closure = g_new0 (SetClosure, 1);
closure->property = g_strdup (property); closure->property = g_strdup (property);
closure->value = g_variant_ref_sink (value); closure->value = g_variant_ref_sink (value);
g_task_set_task_data (task, closure, set_closure_free); g_task_set_task_data (task, closure, set_closure_free);

View File

@ -134,7 +134,7 @@ secret_value_new_full (gchar *secret,
if (length < 0) if (length < 0)
length = strlen (secret); length = strlen (secret);
value = g_slice_new0 (SecretValue); value = g_new0 (SecretValue, 1);
value->refs = 1; value->refs = 1;
value->content_type = g_strdup (content_type); value->content_type = g_strdup (content_type);
value->destroy = destroy; value->destroy = destroy;
@ -243,7 +243,7 @@ secret_value_unref (gpointer value)
g_free (val->content_type); g_free (val->content_type);
if (val->destroy) if (val->destroy)
(val->destroy) (val->secret); (val->destroy) (val->secret);
g_slice_free (SecretValue, val); g_free (val);
} }
} }
@ -296,7 +296,7 @@ secret_value_unref_to_password (SecretValue *value,
*length = val->length; *length = val->length;
} }
g_free (val->content_type); g_free (val->content_type);
g_slice_free (SecretValue, val); g_free (val);
} else { } else {
result = egg_secure_strndup (val->secret, val->length); result = egg_secure_strndup (val->secret, val->length);
@ -343,7 +343,7 @@ _secret_value_unref_to_string (SecretValue *value)
(val->destroy) (val->secret); (val->destroy) (val->secret);
} }
g_free (val->content_type); g_free (val->content_type);
g_slice_free (SecretValue, val); g_free (val);
} else { } else {
result = g_strndup (val->secret, val->length); result = g_strndup (val->secret, val->length);