Fix memory leaks.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22197 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
uau 2007-02-10 18:12:03 +00:00
parent 945cb3447e
commit e876e45030
5 changed files with 17 additions and 10 deletions

View File

@ -234,10 +234,10 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
// 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

View File

@ -163,8 +163,9 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
// 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;
}

View File

@ -362,7 +362,8 @@ static void uninit(struct af_instance_s *af)
free(af->setup);
}
if(af->data)
free(af->data);
free(af->data->audio);
free(af->data);
}
/* Filter data through filter

View File

@ -79,10 +79,14 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
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 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
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));
}
}

View File

@ -298,7 +298,8 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
static void uninit(struct af_instance_s* af)
{
if(af->data)
free(af->data);
free(af->data->audio);
free(af->data);
}
// Filter data through filter