[FFmpeg-devel] [PATCH] fix for malloc error (roundup issues 2480, 2479)

Paul Flinders paul
Mon Jan 3 19:22:00 CET 2011

On 03/01/11 18:01, Daniel Kang wrote:
> I am a Google Code-In student, and as part of a task, I have zzufed
> several files. It seems for extraordinary large total frames, ffmpeg
> fails on mallocating memory. Both bugs have been reproduced, so it is
> not only a bug on my box.
> The patches attached fix the issues locally. Another solution is to move
> the check into av_malloc, but that may create extra overhead. I am not
> sure what the best solution may be.
> Are there any suggestions?
That you misunderstand how (av_)malloc works and misunderstand how 
sizeof works?

malloc returns a block of size requested or NULL.

sizeof is a compile-time constant - it cannot tell you how many bytes 
malloc allocated.

More information about the ffmpeg-devel mailing list