mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-14 01:30:19 +00:00
Use glib for all allocations
- Removes need to check for malloc failure - Removes need for NULL checks on free - Adds checks for integer overflows - Removes some extra memset calls - Removes chance of mixing libc and glib malloc/free
This commit is contained in:
@@ -42,7 +42,7 @@ struct _tree
|
||||
tree *
|
||||
tree_new (tree_cmp_func *cmp, void *data)
|
||||
{
|
||||
tree *t = calloc (1, sizeof (tree));
|
||||
tree *t = g_new0 (tree, 1);
|
||||
t->cmp = cmp;
|
||||
t->data = data;
|
||||
return t;
|
||||
@@ -53,9 +53,8 @@ tree_destroy (tree *t)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
if (t->array)
|
||||
free (t->array);
|
||||
free (t);
|
||||
g_free (t->array);
|
||||
g_free (t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user