recv: Init and teardown btr node.
authorAndre Noll <maan@systemlinux.org>
Mon, 28 Dec 2009 21:09:34 +0000 (22:09 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 28 Dec 2009 21:09:34 +0000 (22:09 +0100)
buffer_tree.h
recv.c

index 18b9e8a..8a7a33b 100644 (file)
@@ -2,5 +2,6 @@
 struct btr_node;
 
 struct btr_node *btr_new_node(char *name, struct btr_node *parent);
+void btr_del_node(struct btr_node *btrn);
 void btr_add_output(char *buf, size_t size, struct btr_node *btrn);
 bool btr_is_leaf_node(struct btr_node *btrn);
diff --git a/recv.c b/recv.c
index d2af644..e04f648 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -92,6 +92,7 @@ int main(int argc, char *argv[])
        }
        r = &receivers[receiver_num];
        rn.receiver = r;
+       rn.btr_root = btr_new_node("receiver", NULL /* no parent */);
        ret = r->open(&rn);
        if (ret < 0)
                goto out;
@@ -110,8 +111,10 @@ int main(int argc, char *argv[])
 
        ret = schedule(&s);
 out:
-       if (r_opened)
+       if (r_opened) {
+               btr_del_node(rn.btr_root);
                r->close(&rn);
+       }
        if (r)
                r->shutdown();
        if (ret < 0)