Fix a couple of memory leaks.
authorAndre Noll <maan@systemlinux.org>
Sat, 6 Feb 2010 23:23:47 +0000 (00:23 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 6 Feb 2010 23:23:47 +0000 (00:23 +0100)
Found by valgrinds memory checker.

dccp_recv.c
fecdec_filter.c
http_recv.c
prebuffer_filter.c
recv.c
recv_common.c
udp_recv.c

index 0b62529..0fddcfa 100644 (file)
@@ -47,6 +47,7 @@ static void dccp_recv_close(struct receiver_node *rn)
 
        if (pdd && pdd->fd > 0)
                close(pdd->fd);
+       btr_pool_free(pdd->btrp);
        free(rn->private_data);
        rn->private_data = NULL;
 }
@@ -140,6 +141,7 @@ err:
 static void dccp_recv_free_config(void *conf)
 {
        dccp_recv_cmdline_parser_free(conf);
+       free(conf);
 }
 
 /**
index 8ccc2ee..3c0c67b 100644 (file)
@@ -431,6 +431,7 @@ static void fecdec_close(struct filter_node *fn)
        FOR_EACH_FECDEC_GROUP(fg, pfd)
                clear_group(fg);
        fec_free(pfd->fec);
+       btr_pool_free(pfd->btrp);
        free(fn->private_data);
        fn->private_data = NULL;
 }
index 035d1f1..bd234a0 100644 (file)
@@ -186,6 +186,7 @@ static int http_recv_open(struct receiver_node *rn)
 static void http_recv_free_config(void *conf)
 {
        http_recv_cmdline_parser_free(conf);
+       free(conf);
 }
 
 /**
index ac66b20..44ad5af 100644 (file)
@@ -74,7 +74,6 @@ static void prebuffer_post_select(__a_unused struct sched *s, struct task *t)
        if (iqs < conf->size_arg)
                return;
        btr_splice_out_node(btrn);
-       prebuffer_close(fn);
        t->error = -E_PREBUFFER_SUCCESS;
 }
 
diff --git a/recv.c b/recv.c
index 5cd64cc..df1afb3 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -115,7 +115,7 @@ out:
                r->close(&rn);
        btr_free_node(rn.btrn);
        btr_free_node(sot.btrn);
-       free(rn.conf);
+       r->free_config(rn.conf);
        if (ret < 0)
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
        return ret < 0? EXIT_FAILURE : EXIT_SUCCESS;
index bbaf139..b496f4e 100644 (file)
@@ -55,7 +55,7 @@ static void *parse_receiver_args(int receiver_num, char *options)
        }
        argv[0] = make_message("%s_recv", r->name);
        conf = r->parse_config(argc, argv);
-       for (i = 1; i < argc; i++)
+       for (i = 0; i < argc; i++)
                free(argv[i]);
        free(argv);
        return conf;
index 2657bee..d899e43 100644 (file)
@@ -209,6 +209,7 @@ err:
 static void udp_recv_free_config(void *conf)
 {
        udp_recv_cmdline_parser_free(conf);
+       free(conf);
 }
 
 /**