From: Andre Noll Date: Sat, 6 Feb 2010 23:23:47 +0000 (+0100) Subject: Fix a couple of memory leaks. X-Git-Tag: v0.4.2~61 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=a118b7220a705ad1f7831270018ee357d40242db;p=paraslash.git Fix a couple of memory leaks. Found by valgrinds memory checker. --- diff --git a/dccp_recv.c b/dccp_recv.c index 0b62529f..0fddcfac 100644 --- a/dccp_recv.c +++ b/dccp_recv.c @@ -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); } /** diff --git a/fecdec_filter.c b/fecdec_filter.c index 8ccc2ee2..3c0c67bc 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -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; } diff --git a/http_recv.c b/http_recv.c index 035d1f19..bd234a02 100644 --- a/http_recv.c +++ b/http_recv.c @@ -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); } /** diff --git a/prebuffer_filter.c b/prebuffer_filter.c index ac66b203..44ad5af1 100644 --- a/prebuffer_filter.c +++ b/prebuffer_filter.c @@ -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 5cd64cc7..df1afb36 100644 --- 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; diff --git a/recv_common.c b/recv_common.c index bbaf1396..b496f4e4 100644 --- a/recv_common.c +++ b/recv_common.c @@ -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; diff --git a/udp_recv.c b/udp_recv.c index 2657beec..d899e439 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -209,6 +209,7 @@ err: static void udp_recv_free_config(void *conf) { udp_recv_cmdline_parser_free(conf); + free(conf); } /**