[FFmpeg-cvslog] lavf: Avoid using av_malloc(0) in av_dump_format

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Oct 5 19:19:22 CEST 2011


On Sat, Oct 01, 2011 at 03:06:41AM +0200, Martin Storsjö wrote:
> ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri Sep 30 20:30:35 2011 +0300| [e81e5e8ad2bb5746df0c343c396019aca165cf66] | committer: Martin Storsjö
> 
> lavf: Avoid using av_malloc(0) in av_dump_format
> 
> On OS X, av_malloc(0) returns pointers that cause crashes when
> freed.

I find that hard to believe, and even more handling this here
is not right. Even more so since mem.c already has this:
if (size) //OSX on SDK 10.6 has a broken posix_memalign implementation

> -    uint8_t *printed = av_mallocz(ic->nb_streams);
> +    uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
>      if (ic->nb_streams && !printed)

In addition, with our av_malloc implementation we do not really need the
ic->nb_streams part of this if...


More information about the ffmpeg-cvslog mailing list