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

Martin Storsjö git at videolan.org
Sat Oct 1 21:38:58 CEST 2011


ffmpeg | branch: release/0.8 | Martin Storsjö <martin at martin.st> | Fri Sep 30 20:30:35 2011 +0300| [932b5f3cbb22b9357d60914f85675020041299e0] | committer: Michael Niedermayer

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)

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index eaa8bd9..e79f98e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3437,7 +3437,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