recv improvements.
[paraslash.git] / recv.c
diff --git a/recv.c b/recv.c
index c8edb59..ca50556 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -92,6 +92,8 @@ int main(int argc, char *argv[])
        }
        r = &receivers[receiver_num];
        rn.receiver = r;
+       if (conf.buffer_tree_given)
+               rn.btrn = btr_new_node("receiver", NULL, NULL, NULL);
        ret = r->open(&rn);
        if (ret < 0)
                goto out;
@@ -113,10 +115,13 @@ int main(int argc, char *argv[])
 
        ret = schedule(&s);
 out:
-       if (conf.buffer_tree_given)
-               btr_free_node(sot.btrn);
        if (r_opened)
                r->close(&rn);
+       if (conf.buffer_tree_given) {
+               btr_free_node(rn.btrn);
+               btr_free_node(sot.btrn);
+       }
+       free(rn.conf);
        if (r)
                r->shutdown();
        if (ret < 0)