[FFmpeg-devel] [PATCH] libavcodec vc1dec memory leak fix

Alper Akcan alper.akcan
Tue Feb 23 23:42:15 CET 2010


hi,

memory leak in livavcodec/vc1dec.c, the problem is MPV_commont_init()
is called twice from vc1_decode_init()

1- vc1_decode_init() [ libavcodec/vc1dec.c:2977 ]
     ff_h263_decode_init() [ libavcodec/vc1dec.c:2997 ]
       MPV_commont_init() [ libavcodec/h263dec.c::115 ]
         lots of allocz ... [ libavcodec/mpegvideo.c:444-644 ]

2- vc1_decode_init() [ libavcodec/vc1dec.c:2977 ]
     ff_msmpeg4_decode_init() [ libavcodec/vc1dec.c:3001 ]
       ff_h263_decode_init() [ libavcodec/msmpeg4.c:1282 ]
         MPV_commont_init() [ libavcodec/h263dec.c::115 ]
           lots of allocz ... [ libavcodec/mpegvideo.c:444-644 ]

which causes at least 1 mb of mem leak.

I am attaching two possible fixes.

1- deleting first call for ff_263_decode_init() in vc1_decode_init() function.
2- doing MPV_common_end, before in the very beginning of
MPV_common_init() which will free prev allocz.

I do not know which one is better for ffmpeg.

cheers,
alper akcan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 00-do-not-call-h363_decode_init-twice.diff
Type: application/octet-stream
Size: 441 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100224/2b7773e7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01-free-MPV-before-init.diff
Type: application/octet-stream
Size: 491 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100224/2b7773e7/attachment-0001.obj>



More information about the ffmpeg-devel mailing list