Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
check | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/check b/check
index 2611e82..0fa81bb 100755
--- a/check
+++ b/check
@@ -22,7 +22,7 @@ help_all() {
echo " mock Test doing a mock build"
echo " coverity Run coverity"
echo " abi Check abi compatibility"
- echo " api api sanity test"
+ echo " api_sanity api sanity test"
echo
echo " help This help"
echo
--
1.7.7.4
Show replies by date
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/trie.c | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/lib/trie.c b/lib/trie.c
index 9561b99..6a102c8 100644
--- a/lib/trie.c
+++ b/lib/trie.c
@@ -335,15 +335,35 @@ trie_lookup(struct trie *t, const char *key, int exact_match)
static void
trie_node_release(struct trie *t, struct trie_node *node)
{
- if (node->num_children == 0 &&
- node->refcount == 0 &&
+ int i;
+ int empty = QB_FALSE;
+
+ if (node->key == NULL &&
node->parent != NULL &&
qb_list_empty(&node->notifier_head)) {
struct trie_node *p = node->parent;
+
+ if (node->num_children == 0) {
+ empty = QB_TRUE;
+ } else {
+ empty = QB_TRUE;
+ for (i = node->num_children - 1; i >= 0; i--) {
+ if (node->children[i]) {
+ empty = QB_FALSE;
+ break;
+ }
+ }
+ }
+ if (!empty) {
+ return;
+ }
+
/*
* unlink the node from the parent
*/
p->children[node->idx] = NULL;
+ free(node->segment);
+ free(node->children);
free(node);
t->num_nodes--;
t->mem_used -= sizeof(struct trie_node);
--
1.7.7.4