[FFmpeg-cvslog] r22119 - in trunk/libavutil: tree.c tree.h

Michael Niedermayer michaelni
Tue Mar 2 21:04:04 CET 2010


On Tue, Mar 02, 2010 at 08:51:41PM +0100, Vitor Sessak wrote:
> Michael Niedermayer wrote:
>> On Tue, Mar 02, 2010 at 08:37:38PM +0100, Vitor Sessak wrote:
>>> Michael Niedermayer wrote:
>> [...]
>>> Ok, thanks. Attached patch fixes the function and use it to plug the 
>>> memleak.
>> attachment fell off the email during transport it seems
>
> Just to keep the tradition going ;)
>
> -Vitor

>  libavformat/nut.c    |   16 ++++++++++++++++
>  libavformat/nut.h    |    1 +
>  libavformat/nutdec.c |    1 +
>  libavformat/nutenc.c |    1 +
>  libavutil/avutil.h   |    2 +-
>  libavutil/tree.c     |    8 +++-----
>  libavutil/tree.h     |   13 +++++++++++++
>  7 files changed, 36 insertions(+), 6 deletions(-)
> 9060fad44f3129d750f0e334cd777283dc5c85ae  nuttree3.diff
> Index: libavutil/tree.c
> ===================================================================
> --- libavutil/tree.c	(revision 22135)
> +++ libavutil/tree.c	(working copy)
> @@ -135,16 +135,14 @@
>      }
>  }
>  
> -#if 0
> -void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, void *elem), int (*enu)(void *opaque, void *elem)){
> +void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, const void *elem), int (*enu)(void *opaque, void *elem)){

>      if(t){
>          int v= cmp ? cmp(opaque, t->elem) : 0;
> -        if(v>=0) av_tree_enumerate(t->child[0], opaque, cmp, enu);
> +        if(v==0 || v>=0) av_tree_enumerate(t->child[0], opaque, cmp, enu);
>          if(v==0) enu(opaque, t->elem);
> -        if(v<=0) av_tree_enumerate(t->child[1], opaque, cmp, enu);
> +        if(v==0 || v<=0) av_tree_enumerate(t->child[1], opaque, cmp, enu);

does your compile need this?


[...]
> Index: libavformat/nut.c
> ===================================================================
> --- libavformat/nut.c	(revision 22109)
> +++ libavformat/nut.c	(working copy)
> @@ -69,6 +69,22 @@
>      }
>  }
>  
> +static int cmp_always_0(void *a, const void *b)
> +{
> +    return 0;
> +}
> +
> +static void enu_free(void *opaque, void *elem)
> +{
> +    av_free(elem);
> +}
> +
> +void ff_nut_free_sp(NUTContext *nut)
> +{
> +    av_tree_enumerate(nut->syncpoints, NULL, cmp_always_0, enu_free);
> +    av_tree_destroy(nut->syncpoints);
> +}

NULL should work fine instead of cmp_always_0

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20100302/64501b7b/attachment.pgp>



More information about the ffmpeg-cvslog mailing list