[MPlayer-dev-eng] memory leak in the libaf/af.c

Uoti Urpala uoti.urpala at pp1.inet.fi
Sat Feb 10 01:43:27 CET 2007


On Sat, 2007-02-10 at 01:34 +0100, Guillaume POIRIER wrote:
> This is maybe silly for me to say that, but wouldn't it be better to write:
> 
>      data=af->play(af,data);
>      af=af->next;
>    }while(af);
> +  if (af) {
> +    free(af);
> +    af=NULL;
> +  }
>    return data;
>  }

Yes it is silly. First, free(NULL) is valid (no-op) so the test is
useless. Second, af is a local variable so changing it before returning
is also useless. Third, the patch was wrong anyway.




More information about the MPlayer-dev-eng mailing list