aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/trie.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-04-19 01:17:54 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-04-19 01:17:54 -0300
commit86b551fdf2a8bf5c6e3cebcc463ee830d65ced94 (patch)
tree2ea95245b5d1e82d8a7197206e2b640aa54119aa /src/utils/trie.c
parentfbc22f39090802845c3a046c3e10bae63d6af6cc (diff)
downloadblogc-86b551fdf2a8bf5c6e3cebcc463ee830d65ced94.tar.gz
blogc-86b551fdf2a8bf5c6e3cebcc463ee830d65ced94.tar.bz2
blogc-86b551fdf2a8bf5c6e3cebcc463ee830d65ced94.zip
safe mallocs are better :)
Diffstat (limited to 'src/utils/trie.c')
-rw-r--r--src/utils/trie.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utils/trie.c b/src/utils/trie.c
index b92573f..d33c600 100644
--- a/src/utils/trie.c
+++ b/src/utils/trie.c
@@ -15,7 +15,7 @@
b_trie_t*
b_trie_new(void (*free_func)(void *ptr))
{
- b_trie_t *trie = malloc(sizeof(b_trie_t));
+ b_trie_t *trie = b_malloc(sizeof(b_trie_t));
trie->root = NULL;
trie->free_func = free_func;
return trie;
@@ -59,7 +59,7 @@ b_trie_insert(b_trie_t *trie, const char *key, void *data)
while (1) {
if (trie->root == NULL || (parent != NULL && parent->child == NULL)) {
- current = malloc(sizeof(b_trie_node_t));
+ current = b_malloc(sizeof(b_trie_node_t));
current->key = *key;
current->data = NULL;
current->next = NULL;
@@ -85,7 +85,7 @@ b_trie_insert(b_trie_t *trie, const char *key, void *data)
if (previous == NULL || parent != NULL)
goto clean;
- current = malloc(sizeof(b_trie_node_t));
+ current = b_malloc(sizeof(b_trie_node_t));
current->key = *key;
current->data = NULL;
current->next = NULL;