[FFmpeg-cvslog] r22119 - in trunk/libavutil: tree.c tree.h
Vitor Sessak
vitor1001
Tue Mar 2 22:29:47 CET 2010
Michael Niedermayer wrote:
> 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?
No, it was my brain that needed this, I was reading ">" instead of ">="
(and that was also why I wasn't understanding this code) :p
>> 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
Sure, new patch attached.
-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nuttree4.diff
Type: text/x-patch
Size: 3955 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20100302/dc692679/attachment.bin>
More information about the ffmpeg-cvslog
mailing list