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

Martin Storsjö git at videolan.org
Mon Mar 19 05:30:24 CET 2012


ffmpeg | branch: release/0.8 | Martin Storsjö <martin at martin.st> | Fri Sep 30 20:30:35 2011 +0300| [151aaf539f0d1010471f916082742b3d80da1359] | committer: Reinhard Tartler

lavf: Avoid using av_malloc(0) in av_dump_format

On OS X, av_malloc(0) returns pointers that cause crashes when
freed.

Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit e81e5e8ad2bb5746df0c343c396019aca165cf66)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=151aaf539f0d1010471f916082742b3d80da1359
---

 libavformat/utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index aa3ca59..65176d4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3320,7 +3320,7 @@ void av_dump_format(AVFormatContext *ic,
                     int is_output)
 {
     int i;
-    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)
         return;
 



More information about the ffmpeg-cvslog mailing list