[FFmpeg-devel] Memory leak using bitstream filters with shared libs

Luca Barbato lu_zero
Mon Mar 10 14:34:31 CET 2008


Michael Niedermayer wrote:
> 
> ugh ....
> No it would not do. It completely defeats the sense behind destruct() that
> is to allow a destruct different from what av_free() does.
> One solution i could see is to:
>  static inline void av_free_packet(AVPacket *pkt)
>  {
> -    if (pkt && pkt->destruct) {
> -        pkt->destruct(pkt);
> +    if(pkt){
> +        if(pkt->destruct)
> +            pkt->destruct(pkt);
> +        pkt->data = NULL; pkt->size = 0;
>      }
>  }
> ----
>  void av_destruct_packet(AVPacket *pkt)
>  {
>      av_free(pkt->data);
> -    pkt->data = NULL; pkt->size = 0;
>  }
> ----
> -void av_destruct_packet_nofree(AVPacket *pkt)
> -{
> -    pkt->data = NULL; pkt->size = 0;
> -}
> 
> and use NULL instead of av_destruct_packet_nofree
> 
> Anyway ive no interrest to workaround binutil bugs, if anyone cares he has
> to do the work and testing.

given that it says that you have to use -Bsymbolic with shared objects 
and that implies PIC (no, x86 is broken for not using PIC and that horse 
has been already beaten)... Still the change you proposed should cleanup 
ffmpeg from an API ugliness.

lu

-- 

Luca Barbato
Gentoo Council Member
Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero





More information about the ffmpeg-devel mailing list