Mercurial > mplayer.hg
changeset 22179:ecf562795caf
Fix memory leaks.
author | uau |
---|---|
date | Sat, 10 Feb 2007 18:12:03 +0000 |
parents | c4d9550c9faf |
children | 13815ffcada5 |
files | libaf/af_channels.c libaf/af_format.c libaf/af_hrtf.c libaf/af_lavcresample.c libaf/af_resample.c |
diffstat | 5 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libaf/af_channels.c Sat Feb 10 18:05:18 2007 +0000 +++ b/libaf/af_channels.c Sat Feb 10 18:12:03 2007 +0000 @@ -234,10 +234,10 @@ // Deallocate memory static void uninit(struct af_instance_s* af) { - if(af->setup) - free(af->setup); - if(af->data) - free(af->data); + free(af->setup); + if (af->data) + free(af->data->audio); + free(af->data); } // Filter data through filter
--- a/libaf/af_format.c Sat Feb 10 18:05:18 2007 +0000 +++ b/libaf/af_format.c Sat Feb 10 18:12:03 2007 +0000 @@ -163,8 +163,9 @@ // Deallocate memory static void uninit(struct af_instance_s* af) { - if(af->data) - free(af->data); + if (af->data) + free(af->data->audio); + free(af->data); af->setup = 0; }
--- a/libaf/af_hrtf.c Sat Feb 10 18:05:18 2007 +0000 +++ b/libaf/af_hrtf.c Sat Feb 10 18:12:03 2007 +0000 @@ -362,7 +362,8 @@ free(af->setup); } if(af->data) - free(af->data); + free(af->data->audio); + free(af->data); } /* Filter data through filter
--- a/libaf/af_lavcresample.c Sat Feb 10 18:05:18 2007 +0000 +++ b/libaf/af_lavcresample.c Sat Feb 10 18:12:03 2007 +0000 @@ -79,10 +79,14 @@ static void uninit(struct af_instance_s* af) { if(af->data) - free(af->data); + free(af->data->audio); + free(af->data); if(af->setup){ af_resample_t *s = af->setup; if(s->avrctx) av_resample_close(s->avrctx); + int i; + for (i=0; i < AF_NCH; i++) + free(s->in[i]); free(s); } } @@ -109,7 +113,7 @@ if(s->in_alloc < in_len + s->index){ s->in_alloc= in_len + s->index; for(i=0; i<chans; i++){ - s->in[i]= realloc(s->in[i], s->in_alloc*sizeof(int16_t)); //FIXME free this maybe ;) + s->in[i]= realloc(s->in[i], s->in_alloc*sizeof(int16_t)); } }